# Network Configuration

Things to do with network configurations


# Add/Remove IPs

Add

ip addr add <IP>/<MASK> dev <DEVICE>

Remove

ip addr del <IP>/<MASK> dev <DEVICE>

# Netplan

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - <IP1>/24
        - <IP2>/32
      nameservers:
          search: [mydomain, otherdomain]
          addresses: [10.10.10.1, 1.1.1.1]
      routes:
        - to: 0.0.0.0/0
          via: <GATEWAY>
          on-link: true

# Routes

# Route info

IPv4

ip route

IPv6

ip -6 route

# Gateways

Add specific gateway

ip route add <IP>/<MASK> dev <DEVICE>

Set default route

ip route add default via <IP>/<MASK>

# Example Configs

# IPv6

iface ens3 inet6 static
address 2001:xxxx:xxxx::1234
netmask 128
post-up /sbin/ip -6 route add 2001:xxxx:xxxx::0001 dev ens3
post-up /sbin/ip -6 route add default via 2001:xxxx:xxxx::0001
pre-down /sbin/ip -6 route del default via 2001:xxxx:xxxx::0001
pre-down /sbin/ip -6 route del 2001:xxxx:xxxx::0001 dev ens3

# IPv4

auto ens160
iface ens160 inet static
address 123.456.789.012
netmask 255.255.255.0
gateway 123.456.789.254
post-up /sbin/ip route add 123.456.789.254 dev ens160
post-up /sbin/ip route add default via 123.456.789.254
pre-down /sbin/ip route del default via 123.456.789.254
pre-down /sbin/ip route del 123.456.789.254 dev ens160

# DNS servers

# Custom entries in /etc/resolv.conf

  • Create or edit the file at /etc/resolvconf/resolv.conf.d/tail

nano/vim /etc/resolvconf/resolv.conf.d/tail

nameserver 1.1.1.1

# NDP Proxy IPv6

Just some notes I had on making an IPv6 block available to a VM on something like Proxmox The steps are pretty generic, so you will need to make the changes according to your OS setup.

# Host config:

vmbr0 = external vmbr1 = dummy0

vmbr0 = IP:v6::/64

vmbr1 = Host:IP:v6:addr

ip -6 addr add Host:IP:v6:addr/64 dev vmbr1

Delete IP:v6::/64 route from vmbr0

echo "1" > /proc/sys/net/ipv6/conf/vmbr0/proxy_ndp
echo "1" > /proc/sys/net/ipv6/conf/all/forwarding

Add these to your system config:

net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.proxy_ndp = 1
net.ipv6.conf.all.proxy_ndp = 1

ip -6 neigh add proxy IP:v6:vm:addr/64 dev vmbr0

ip -6 neigh add proxy IP:v6:vm:addr/64 dev vmbr1

# VM Config:

IP = IP:v6:vm:addr/64

ip -6 addr add IP:v6:vm:addr/64 dev eth0

Edit your network settings so that your gateway = Host:IP:v6:addr

Last Updated: 2021/03/31 12:28+00:00