Friday 28 August 2009

Linux network setup

Because I always forget the syntax of this file....

The file controlling network IP address settings in linux is "/etc/network/interfaces" on Debian based systems - to set static IP addresses use the syntax below (first example is IPv6, next is standard IPv4)

iface eth0 inet6 static
address 2001:470:1f09:12e9::<host address>
netmask 64
gateway 2001:470:1f09:12e9::1 (or whatever your gateway is)

iface eth0 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1

Force a restart of the network with:
#ifup --force eth0

Adding a route for IPv6:
#route -A inet6 add 2001:470:1f09:12e9::/64 gw 2001:470:1f09:12e9::200
Another way to add a new route to linux that routes everything via 2001:470:96fb::1 (replace "add" with "del" to delete)
# /sbin/ip -6 route add ::/0 via 2001:470:96fb::1
Show current IPv6 routes:
# route -n -A inet6

The server used for resolving DNS is set in /etc.resolv.conf

No comments:

Post a Comment