Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two PC's and a series of Juniper EX-2200 switches connected to form a network.None of the devices are connected to any external network.If I do an ifconfig on the first PC (monitor) I see that that PC only has an ethernet address.It does not have an IP address.I want to use an IP address to use applications such as scp.

So I do the following.

sudo ifconfig eth0 netmask

Now if I do an ifconfig the PC shows the IP address of as expected.However it does n't seem to retains the IP address.It seems to lose the IP address after some time.I never rebooted the PC.It is likely that I am receiving ARP traffic on this PC.Can that cause the PC to lose the IP address.If yes,How can I cause the PC to retain the IP address

The route -n on the PC produces the following lines.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use  Iface   U     1000   0        0  eth0   U     0      0        0  eth0

It looks like the default gateway in this case is

share|improve this question
Which distro your PC is running? – quanta Sep 12 '12 at 3:47
I am using Ubuntu 12.04 :) – liv2hak Sep 12 '12 at 3:48
up vote 2 down vote accepted

You need to edit /etc/network/interfaces to keep it permanently, something like this:

auto eth0
iface eth0 inet static
share|improve this answer
can I give the gateway address ( as dummy.Or do I need to have a machine with that IP in the network? – liv2hak Sep 12 '12 at 3:59
and afterwards do I need to restart the script or something? – liv2hak Sep 12 '12 at 4:01
1. What is your current default gateway route -n? 2. Restart the network to make it take effect: sudo /etc/init.d/networking restart. – quanta Sep 12 '12 at 4:04
route -n outputs two lines with Destination Gateway Genmask values.Both the lines have Gateway ( – liv2hak Sep 12 '12 at 4:17
just change the gateway line to, basically it means "anything". – quanta Sep 12 '12 at 4:35

Your Answer


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.