Forcing static address in 12.04

Karl Auer kauer at biplane.com.au
Mon Jun 8 00:47:39 UTC 2015


On Sun, 2015-06-07 at 15:30 -0700, rikona wrote:
> I had to replace a failed router in the lan, and needed to temporarily
> set a 12.04 box to dhcp. It had a fixed IP since installation. After
> the router was configured, I tried to set it back to fixed, but can't.
> The network window(s) let me set 'manual' to get a fixed address, BUT
> the save button gets grayed out and the fixed IP can't be saved.

Just to make sure that we know what's going on, could you please show
us:
- the output from "ifconfig | grep eth"
- the output from "grep eth /etc/udev/rules.d/70-persistent-net-rules"
- the output from "grep eth /etc/network/interfaces"

Assuming you do actually have an eth0 interface, there are two main ways
to give it a fixed IP address:

Using network manager, the usual process would be roughly as follows:

- in /etc/network/interfaces, make sure that eth0 is not mentioned, or
that any lines that do mention it are commented out. Network manager
will not manage any interfaces that are defined
in /etc/network/interfaces.

- right click on network manager applet at top right

- click on "edit connections"

- locate the ethernet interface (usually at the top of the list)

- if no connections are shown under "Ethernet", click the little
triangle at left of the entry, that should drop down a list of available
ethernet connections

- click on "wired connection 1"

- click on the "edit" button

- in the edit dialogue, click on the "General" tab

- check "automatically connect" and "all users may connect"

- leave everything else alone in this tab

- click on the click on "IPv4 settings" tab

- select the "Manual" method

- if any entries are shown, use the "Delete" button to remove them

- click the "Add" button

- type your desired IPv4 address into the "Address field"

- type the right netmask into the "Netmask" field (probably
255.255.255.0)

- type the right gateway address into the "Gateway" field

- type the address of your nameserver into the "DNS Servers" field (you
can put in more than one). If you don't know the right nameserver
address, the address of your router will usually work.

- if you want search domains, type them into the "search domains" field

- check "require IPv4 addressing for this connection to complete"

- click the "Save" button

When you connect your ethernet interface to your network, it should come
up with the desired IPv4 address.

Alternative method:

In /etc/network/interfaces, put something like this:

auto eth0
iface eth0 inet static
   address 192.168.1.99
   netmask 255.255.255.0
   gateway 192.168.1.1
   dns-nameservers 192.168.1.35

Save the changes, then restart Network Manager:

   sudo restart network-manager

Then bring up the interface manually:

   sudo ifup eth0

If you don't make frequent changes to your network configuration, I'd
recommend using the second method.

> Most of the boxes FIPs are set by the router/mac address, and I'd prefer to do it
> there if possible.

If you want to do the fixed IP via a DHCP reservation in the router, and
the router has already given the address out to some other device, then
you will have to make sure that the other device is turned off, then
reboot the router, then put in your reservation. The simplest way to do
this is usually to just unplug everything from your switch except the
desired device (your Linux box in this case), reboot the router, do the
reservation, then plug everything else back in.

Doing DHCP reservations on home routers is generally painful as they
tend to have very primitive little DHCP servers.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
Old fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882





More information about the ubuntu-users mailing list