Interfaces and route

Configurer une interface réseau sur une serveur en Ubuntu.

vim /etc/network/interfaces

  # The loopback network interface
  auto lo
  iface lo inet loopback

  # The primary network interface
  auto eth0
  iface eth0 inet static
  address 192.168.224.88
  gateway 192.168.224.10
  netmask 255.255.255.0
  network 192.168.224.0
  broadcast 192.168.224.255

vim /etc/resolvconf/resolv.conf.d/head

  nameserver 192.168.224.1
  nameserver 192.168.224.3
  nameserver 8.8.8.8

Appliquer :

  /etc/init.d/networking restart
  # ou
  reboot

Del original default GW

  ip route del default 10.25.24.8

Add new default GW

  ip route add default via 10.25.24.8

Add manual route

  ip route add 10.0.0.150 via 10.1.1.1 dev ens18
  ip route add 10.0.2.0/24 via 192.0.0.1 dev enp0s3

Del manual route

  ip route del 10.25.6.150 via 10.25.24.1 dev ens18

Add original default GW

  ip route add default via 10.25.24.1 ens18