Debian Network Setup

From Edgar BV Wiki
Revision as of 07:03, 1 April 2019 by Red (talk | contribs)
Jump to navigation Jump to search

Basic setup

Set up networking in /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#auto eth0
iface eth0 inet static
        address 192.168.0.112
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
#       gateway 192.168.0.1
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1
#       dns-nameservers 192.168.0.1 192.168.0.2
#       dns-search mynet.int internal.mynet.int ops.mynet.int

auto eth1
iface eth1 inet static
        address 188.204.140.195
        netmask 255.255.255.224
        network 188.204.140.192
        broadcast 188.204.140.223
        gateway 188.204.140.193
        dns-nameservers 213.75.63.36 213.75.63.70 192.168.0.1

NB for dns-search or dns-domain lines to work in the above stanzas you need to have the resolvconf package installed. Otherwise you will have to add the following to /etc/resolve.conf

search mynet.int
search internal.mynet.int
...

The allow hotplug line allows the interface to be controlled using the ifup and ifdown scripts, which Debian uses as standard.

Debian NetworkConfiguration wiki page

Debian reference manual Chapter 5. Network setup

To resolvconf or not resolvconf

If using pdnsd - use resolvconf configuration

For more advanced iproute2 information see

Multiple IP addresses on one NIC and Multiple internet connections on one nic

Of which the following is very useful: http://www.policyrouting.org/iproute2.doc.html#ss9.16

ip link list - shows the physical devices

ip addr list - shows the adressees the links have

ip addr show dev eth0

Basic ip route - http://linux-ip.net/html/tools-ip-route.html

ip route list - like netstat -rn

/etc/iproute2/rt_tables - contains the routing tables

ip route show table local / main - shows the specified table

ip -s route show cache

ip route flush cache

NB - ip route flush kills all the routing tables!!!

More on routing tables - http://linux-ip.net/html/routing-tables.html

legacy net-tools commands iproute2 replacement commands
arp ip n (ip neighbor)
ifconfig ip a (ip addr), ip link, ip -s (ip -stats)
iptunnel ip tunnel
nameif ip link
netstat ss, ip route (for netstat -r), ip -s link (for netstat -i), ip maddr (for netstat -g)
route ip r (ip route)

eth0 82.94.91.77

eth0:0 188.204.140.196/27