how to activate nic at startup that has no ip

Asked by systimax

Can someone tell me how do I add a nic to start or come active at boot that doesnt have a ip adress associated to it?

After a boot I can ifconfig eth1 up and its up. however unless i do that it wont be active

My /etc/network/interface looks like this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto eth1

auto eth2

myserver@ubuntuVMwareServer6:~$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:C3:44:EC
          inet addr:10.5.1.86 Bcast:10.5.255.255 Mask:255.255.0.0
          inet6 addr: fe80::20c:29ff:fec3:44ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:642 errors:0 dropped:0 overruns:0 frame:0
          TX packets:318 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:55757 (54.4 KiB) TX bytes:37477 (36.5 KiB)
          Interrupt:185 Base address:0x1400

eth1 Link encap:Ethernet HWaddr 00:0C:29:C3:44:F6
          BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
          Interrupt:177 Base address:0x1480

eth2 Link encap:Ethernet HWaddr 00:0C:29:C3:44:00
          BROADCAST MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
          Interrupt:193 Base address:0x1800

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:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:416 (416.0 b) TX bytes:416 (416.0 b)

sit0 Link encap:IPv6-in-IPv4
          NOARP MTU:1480 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
systimax
Solved:
Last query:
Last reply:
Revision history for this message
Ralph Janke (txwikinger) said :
#1

Thanks for your question.

I am not sure that I understand what you want to achieve. A network card without an address cannot perform any task, If you have a dhcp server in the network the card is connected to, you can just add a line 'iface eth1 inet dhcp' after the line auto eth1, and it will obtain the right configuration. Otherwise you can use 'iface eth1 inet static' with lines following giving the configuration if you give the information 'statically'.

I hope this helps.

Revision history for this message
systimax (jasondgallagher) said :
#2

In my case it can. For example a Ubuntu installed with Vmware server or workstation.

You can bridge nics to virtual switches when the nic does not have a ip. Then only the virtual machines have ip addresses. That way if you have a server with 2 physical nics one nic can be bridged to a dmz with no ip adress and one can be bridged to the internal lan with an ip.

With no firewall any vm in the DMZ can not enter the internal lan. Simply because the bridged nic only has vmware protocol and no tcp address or bindings

This is recommended for security.

And it works when i manually do it. Ifconfig eth1 up bam my ipless nic starts to flow with vm traffic. and the vm hosts can web browsing ..what ever

Another example is using Snort you add nics with no ips for inline scanning Another is Ethereal, You can also bridge nics in Ipfw with no ips to create a sort of invisible firewall

Regardles of waht you can do with a nic with no IP

I'm just looking to how to add it to activate at boot. I guess i could just add ifconfig eth1 and to a start up script correct?

Revision history for this message
systimax (jasondgallagher) said :
#3

Actually ignore this line "I guess i could just add ifconfig eth1 and to a start up script correct?"

I still need to have the ip less nic eth1 start at the same time as the eth0 starts.

Whats the script that runs at startup.. when ubuntu starts and it says something like
starting basic networking OK
configuring network interfaces OK
Starting system log OK

maybe i can edit one of those scripts to start my eth1

I need it to start before i get down to some other services that depend on it.

Revision history for this message
Ralph Janke (txwikinger) said :
#4

What happens if you use 'up' instead of 'auto' for this interface?

Revision history for this message
systimax (jasondgallagher) said :
#5

Doest seem to work

when i make /etc/network/interface looks like this

# The primary network interface
auto eth0
iface eth0 inet dhcp

up eth1

up eth2

Revision history for this message
Best systimax (jasondgallagher) said :
#6

I found out what i needed.

Created a script and made it executable in init.d = ifconfig -eth1 up

ran

update.rc.d -f script name 41 2345 .

This creates the needed symlinks in all the RC dirs for run level 2345. and sets it at 41 so it runs before the vmware service.