Editing /etc/network/interfaces manually

Share your own howto's etc. Not for support questions!

Editing /etc/network/interfaces manually

Postby bluesdog » 2006-06-21 05:09

Typing dmesg|grep eth will give you information regarding boot time detection of ethernet devices. Example:
dmesg|grep eth
eth0: RealTek RTL8139 at 0xb800, 00:40:05:87:17:3e, IRQ 106
eth0: Identified 8139 chip type 'RTL-8100B/8139D'
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
eth0: no IPv6 routers present
Typing sudo /sbin/ifconfig -a in a terminal or ifconfig -a in a root terminal will give you detailed information on network status. Example:
sudo /sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:40:05:87:17:3E
inet addr:192.168.0.101 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::240:5ff:fe87:173e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7189 errors:0 dropped:0 overruns:0 frame:0
TX packets:6086 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4563571 (4.3 MiB) TX bytes:729154 (712.0 KiB)
Interrupt:106 Base address:0xb800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:209 errors:0 dropped:0 overruns:0 frame:0
TX packets:209 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13585 (13.2 KiB) TX bytes:13585 (13.2 KiB)
specifying the interface will limit ifconfig's output. Example:
sudo /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:40:05:87:17:3E
inet addr:192.168.0.101 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::240:5ff:fe87:173e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7661 errors:0 dropped:0 overruns:0 frame:0
TX packets:6604 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4889708 (4.6 MiB) TX bytes:817735 (798.5 KiB)
Interrupt:106 Base address:0xb800

Sometimes the network configuration tools don't seem to do the job.
I recently setup a network with machines running KDE on Debian, and Gnome on Ubuntu, and found it just faster and easier to manually edit /etc/network/interfaces
I always make a backup before making any changes to critical scripts. Example:
sudo cp /etc/network/interfaces /etc/network/interfaces.backup

Vi is very cool, and very powerful, and very geeky, but I prefer nano for simple text editing.. Example:
sudo nano /etc/network/interfaces
will open the interfaces file for editing, with root privileges.. (as long as you are in the sudoers group).. An alternative is to just su to root, then run the nano command.
While setting up the network, it is faster to test /etc/network/interfaces with root commands. No need to reboot. Example:
sudo ifdown eth0
stops the network,
sudo ifup eth0
starts it.
Read man interfaces for details on the contents of /etc/network/interfaces.
User avatar
bluesdog
 
Posts: 2082
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable