Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If i use static IP adresses i can use more then one per network card, for exemple i can set eth0 to use 192.168.0.1 and eth0:1 to use 192.168.1.1.

And if eth1 get a ip-adress over dhcp, can i somehow make a eth1:1, and get a 2nd ip-adress?

I know that Virtualbox OS can get a different IP-adress, using the same network card as the host, but i hope to get 2 IP-adress for the real computer.

So how can i get a 2nd IP adress from the DHCP server?

Some info about my computer that may or may not be relevant:
Kernel: 3.8.13-gentoo
sys-apps/baselayout: 2.2
sys-apps/openrc: 0.11.8
sys-devel/binutils: 2.23.1

share|improve this question

2 Answers 2

DHCP servers hand out IP addresses based on the MAC address of the requesting device. As such, only a single IP can be handed out for each MAC address. If you need multiple IPs, you need to either throw another NIC in the server, which can get its own IP via DHCP or you need to assign static addresses.

share|improve this answer
    
So virtualboxes emulate a new NIC, or how can it get a different ip then the host using just one physical network card. –  Puggan Se Aug 15 '13 at 18:40
2  
They use a layer 2 bridged interface. I suppose it may be possible to do using similar technologies in linux, but it would be rather unorthodox. It's a bad idea to use DHCP for servers anyway - why not just assign static addresses? –  EEAA Aug 15 '13 at 18:45
    
My ISP only have static addresses available in some network, in my network they only allow DHCP, but they say I can get up to 5 ip-adresses, so was intrested in how to get more then one to my router/server. –  Puggan Se Aug 15 '13 at 18:51
    
Are the IP addresses they allocate you always the same ones? If so, you should just be able to set them as static addresses. I've never heard of a requirement to use DHCP like this. –  EEAA Aug 15 '13 at 18:52
    
I get a new IP-adress about 2 times / year, so they aren't always the same, but maybe i can just set a static 2nd IP-adress, and steal that IP-adress from the same subnet, and hope they route it to me. –  Puggan Se Aug 15 '13 at 19:01

I used a bridge, as EEAA sugested in his comment.

step 1: install bridge-utils, and make sure you got a kernel with CONFIG_BRIDGE on. (if CONFIG_BRIDGE is off in kernel, you get a error like: "add bridge failed: Package not installed" at step 2

step 2: brctl addbr br0 to add a bridge called "br0"

step 3: brctl addif br0 eth1 to connect eth1 to the bridge

step 4: ifconfig br0 hw ether 08:00:27:b7:84:28 to set a new mac-adress, if you use the same mac-adress as eth1, you get the same ip as eth1.

step 5: ifconfig br0 up to activate the interface/bridge

step 6: dhclient br0 to ask for a ip adress for br0

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.