Changing IP addresses in a Linux-run LAN

By John Bowen, 22 September, 2008

I recently set up a Linux (Ubuntu) based network to allow VPN connectivity, and to avoid headaches1 I wanted to modify the internal IP address scheme from the default (192.168.1.0) scheme.

In this network, the Linux server has two NIC's, and external (ADSL) connection and an internal LAN. DHCP, DNS, and Samba shares are served from the internal LAN to as many as 6-7 users at a time. Some of the internal clients have fixed IP's, and some take advantage of the server's DHCP offering to get IP's.

I expected this to be a more difficult process, but it was surprisingly easy to make the changes. I'll try to list the mods needed in the server (and clients) to make the change:

Network Devices
/etc/network/interfaces
All references to the old network have to be changed to the new scheme

DNS (Bind)
/etc/bind/zones/
Both the forward and reverse lookup zones have to be changed

DHCP
/etc/dhcp3/dhcpd.conf
All references to the old network have to be changed to the new scheme

Hosts
/etc/hosts
All references to the old network have to be changed to the new scheme.

Samba
Samba itself doesn't need any changes when the LAN's IP's change, but if client machines have mapped Samba drives using IP addresses (i.e. \\192.168.1.1\share), those mappings will have to be changed at the client.

Firewall (iptables)
The firewall rules are tied to the adapter name (i.e. 'eth2'), not the IP address of the server. So, changing which IP is assigned to the adapter (in /etc/network/interfaces) will take care of the firewall. If your rules worked before, they'll work after the change.

Static Client IP's
Any clients in the internal network (LAN) that have static IP addresses assigned need their assignments changed.

Restart the affected systems:
sudo /etc/init.d/networking restart
sudo /etc/init.d/dhcp-server restart
sudo /etc/init.d/bind9 restart

That's it! As always, your mileage may vary, so back up files before you mess around with them too much.

  1. 1. FWIW, the potential headache there is that if I'm on a friend's network, I've probably already been assigned an IP address from that segment (192.168.1.20, perhaps), so connecting to the VPN would cause problems with routing (because I'd have two IP addresses from the same segment, but from separate networks).

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.