Network configuration with /etc/network/interfaces

When you use Debian Linux, you can administrate your network settings via /etc/network/interfaces.
Here’s a simple example to demonstrate syntax and parameters of the configuration file.

# loopback interface
auto lo
iface lo inet loopback
 
# Interface eth0 gets its IP via DHCP
auto eth0
iface eth0 inet dhcp
# Static IP for eth1
auto eth1
iface eth1 inet static
  address 192.168.222.140
  netmask 255.255.255.0
  network 192.168.222.0
  broadcast 192.168.222.255
  # Default gateway not set, because eth0 gets it via DHCP
  # gateway 192.168.222.254
  # Log status and set route for network 10.0.0.0, when Interface comes up
  up route add -net 10.0.0.0 netmask 255.255.0.0 gw 192.168.222.2 dev $IFACE
  up /usr/bin/logger -t network "Interface $IFACE came up"
  # Log status and delete route for network 10.0.0.0, when Interface goes down
  down route del -net 10.0.0.0 netmask 255.255.0.0 gw 192.168.222.2 dev $IFACE
  down /usr/bin/logger -t network "Interface $IFACE went down"

There is the start script /etc/rcS.d/S40networking, which is executing ifup -a.
So, all interfaces with the keyword auto will be brought up while boot time.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>