# Networking

#### Hosts

```bash
sudo vim /etc/hosts
```

```conf
127.0.0.1       localhost
127.0.1.1       <hostname>.local <hostname>

# The following lines are desirable for IPv6 capable hosts
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
ff02::3         ip6-allhosts

#
192.168.1.254   mabbox.bytel.fr

# local
192.168.1.10    bikinibottom
192.168.1.11    bob
192.168.1.12    carlo
192.168.1.13    gary
192.168.1.14    sandy
192.168.1.15    krabs
192.168.1.16    sheldon
192.168.1.17    bernie

#
192.168.1.53    recalbox

# Optional
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1       kubernetes.docker.internal
# End of section

```

### Broadcom (WiFi)

Réf. : [https://wiki.debian.org/WiFi/HowToUse](https://wiki.debian.org/WiFi/HowToUse)

```bash
cd /lib/firmware/brcm/
ln -s brcmfmac43455-sdio.AW-CM256SM.txt brcmfmac43455-sdio.pine64,rockpro64-v2.0.txt
ln -s brcmfmac43455-sdio.AW-CM256SM.txt brcmfmac43455-sdio.pine64,rockpro64-v2.1.txt

sudo rmmod brcmfmac
sudo modprobe brcmfmac
```

```bash
sudo vim /etc/systemd/network/25-wlan.network
```

```systemd
[Match]
Name=wlan0

[Network]
DHCP=ipv4

[DHCP]
UseDNS=yes
```

```bash
sudo vim /etc/network/interfaces.d/local
```

```conf
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# allow-hotplug end0
auto wlan0
iface wlan0 inet static
    address 192.168.1.xx
    netmask 255.255.255.0
    gateway 192.168.1.254
    dns-nameservers 45.90.28.0
    dns-nameservers 45.90.30.0

# This is an autoconfigured IPv6 interface
iface end0 inet6 auto
```

```bash
sudo vim /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
```

```conf
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="BikiniBottom"
        #psk="transatlantique"
        psk=e5b692f43ab186494b7f37949d9084e1c0e97fd74d8f14a6325be2e62309067e
}
```

```bash
sudo systemctl enable --now wpa_supplicant@wlan0.service

sudo su -l -c "systemctl enable --now systemd-networkd"
```

### Ethernet
#### Debian

```bash
sudo vim /etc/network/interfaces
```

```bash
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/* 
```

```bash
sudo vim /etc/network/interfaces.d/local
```

```conf
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# allow-hotplug end0
auto end0
iface end0 inet static
    address 192.168.1.xx
    netmask 255.255.255.0
    gateway 192.168.1.254
    dns-nameservers 45.90.28.0
    dns-nameservers 45.90.30.0

# This is an autoconfigured IPv6 interface
iface end0 inet6 auto

```

```bash
sudo systemctl restart networking.service
```

#### Ubuntu

```bash
sudo vim /etc/netplan/50-cloud-init.yaml
```

```yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    end0:
      dhcp4: no
      addresses:
        - 192.168.1.xx/24
      routes:
        - to: default
          via: 192.168.1.254
      nameservers:
        addresses: [45.90.28.0, 45.90.30.0]
```

```bash
sudo netplan apply
```

#### DNS Servers

| DNS | Adresses IPv4 | Adresses IPv6 |
| --- | --- | --- |
| 1 [**Cloudflare 1.1.1.1**] | 1.1.1.1<br />1.0.0.1 | 2606:4700:4700::1111<br />2606:4700:4700::1001 |
| 2 [Cisco OpenDNS Home](https://www.opendns.com/) | 208.67.222.222<br />208.67.220.220 | 2620:119:35::35<br />2620:119:53::53 |
| 3 [Neustar UltraDNS Public](https://www.publicdns.neustar/) | 64.6.64.6<br />64.6.65.6 | 2620:74:1b::1:1<br />2620:74:1c::2:2 |
| 4 [NextDNS](https://nextdns.io/fr) | 45.90.28.0<br />45.90.30.0 | 2a07:a8c0::<br />2a07:a8c1::|
| 5 [Google Public DNS](https://developers.google.com/speed/public-dns) | 8.8.8.8<br />8.8.4.4 | 2001:4860:4860::8888<br />2001:4860:4860::8844 |
| 6 [**Quad9**](https://www.quad9.net/) | 9.9.9.9<br />149.112.112.112 | 2620:fe::fe, 2620:fe::9 |
| 7 [Comodo Secure DNS](https://www.comodo.com/secure-dns/)  | 8.26.56.26<br />8.20.247.20 | – |
| 8 [Yandex.DNS](https://dns.yandex.com/ ) | 77.88.8.8<br />77.88.8.1 | 2a02:6b8::feed:0ff<br />2a02:6b8:0:1::feed:0ff |
| 9 [SafeDNS](https://www.safedns.com/fr/) | 195.46.39.39<br />195.46.39.40 | 2001:67c:2778::3939<br />2001:67c:2778::3940 |
