108 lines
1.9 KiB
Markdown
108 lines
1.9 KiB
Markdown
# Networking
|
||
|
||
#### Hosts
|
||
|
||
```bash
|
||
sudo vim /etc/hosts
|
||
```
|
||
|
||
```bash
|
||
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
|
||
|
||
```
|
||
|
||
#### 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
|
||
```
|
||
|
||
```bash
|
||
# 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.12
|
||
netmask 255.255.255.0
|
||
gateway 192.168.1.254
|
||
dns-nameservers 1.1.1.1
|
||
dns-nameservers 1.0.0.1
|
||
# 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.13/24
|
||
routes:
|
||
- to: default
|
||
via: 192.168.1.254
|
||
nameservers:
|
||
addresses: [1.1.1.1, 1.0.0.1]
|
||
```
|
||
|
||
```bash
|
||
sudo netplan apply
|
||
``` |