Search This Blog

Thursday, 7 March 2013

How to create or setup an ethernet interface

The majority of network setup can be done via the interfaces configuration file at /etc/network/interfaces. Here, you can give your network card an IP address (or use dhcp), set up routing information, configure IP masquerading, set default routes and much more.
Remember to add interfaces that you want brought up at boot time to the 'auto' line.


Using DHCP to automatically configure the interface:

If you're just using DHCP then all you need is something like

 
auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
 

Configuring the interface manually:

  If you're configuring it manually then something like this will set the default gateway (network, broadcast and gateway are optional)

  

auto eth0
    iface eth0 inet static
        address 192.168.0.7
        netmask 255.255.255.0
        gateway 192.168.0.254
 
If you want to add an IPv6 address, too, append something like :  

  iface eth0 inet6 static
        address 2001:db8::c0ca:1eaf
        netmask 64
        gateway 2001:db8::1ead:ed:beef

No comments:

Post a Comment