5

Im trying to configure my network to have both a static IP and a DHCP IP

the system in question is ubuntu server 11.10 with only additional software being the LAMP bundle (web server) and OpenSSH.

I tried this configuration bellow with mixed success. sometimes i only get the DHCP IP and not the static one, and other times i get the static IP and not the DCHP one.

Am I doing something wrong with the configuration?


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth0:1
iface eth0:1 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255

2
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
address 192.168.0.2
netmask 255.255.255.0

The DHCP will already get the gateway information. Double gateways cause traffic to stop working. The broadcast is unnecessary as it is already assumed by the netmask.

| improve this answer | |
1

Try to remove the auto eth0:1 and add it together with the first one on this way:

auto eth0 eth0:1
iface eth0 inet dhcp

iface eth0:1 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255

I had Issues when specifying two times auto for the same physical iface.

| improve this answer | |
  • lul, first of all dunno if this will start AT ALL, you only configure the alias NOT THE MAIN IFace (so, IFace may not be up at all), if it does work (and it is possible, dhclient will "guess" stuff), then dhcp will configure eth0 NOT the alias, which made things kinda identical with the question code, and as (the good, above answer say) problem is multiple gateways (one dhcp, and one manually) – THESorcerer Aug 11 '16 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy