Wednesday, April 23, 2008

Bringing Up a Network Interface Without DHCP or an IP Address

This is a useful thing to know if you want to bring up a network interface without using DHCP or assigning it an IP address. This would mostly be used for things like a SNORT server where one interface is just listening in promisc mode and doing nothing else.

I'm using Ubuntu Server 7.10 for this, it may be different for other distributions:

Add this to your /etc/network/interfaces file:

iface eth1 inet manual
pre-up ifconfig $IFACE up
post-down ifconfig $IFACE down

Then test your changes by typing:
ifup eth1
Your interface should come up without the overhead of DHCP or putting a fake IP.

# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00
inet addr:XXX.XXX.XXX.XXX Bcast:XXX.XXX.XXX.XXX Mask:255.255.255.192
inet6 addr: fe80::XXX:a0ff:XXX:bf85/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16061154 errors:0 dropped:0 overruns:0 frame:0
TX packets:18718055 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1044924142 (996.5 MB) TX bytes:361626953 (344.8 MB)
Interrupt:16

eth1 Link encap:Ethernet HWaddr
00:00:00:00:00

inet6 addr: fe80::21b:21ff:fe08:xxxx/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:641984551 errors:358 dropped:30480447 overruns:0 frame:181
TX packets:86416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2577620812 (2.4 GB) TX bytes:21151016 (20.1 MB)
Base address:0xdcc0 Memory:df8c0000-df8e0000

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:7923 errors:0 dropped:0 overruns:0 frame:0
TX packets:7923 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:730857 (713.7 KB) TX bytes:730857 (713.7 KB)