Wednesday, September 4, 2013

How to disable IPV6 on Ubuntu Server 12.04

While deploying a couple of Ubuntu Servers, I ran into an interesting problem. The servers obtained an IPv6 address even though during setup I had specified an IPv4 address. Lets just say after I rebooted I could get online but the purpose for an IPv4 address was defeated since I could not see myself remembering what the IPv6 address was. Detailed below are the steps needed to disable IPV6 and setup a static IPv4 address on an Ubuntu 12.04 server. This should work if on both physical and virtual servers.

First things first we will edit the sysctl.conf file. in your terminal issues the following command:
sudo nano /etc/sysctl.conf.

This should open the file ... Add the following lines to the end of the file:
#IPv6 configuration
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Then ctrl + o to save
Then ctrl + x to exit

Now restart the sysctl service by doing:
sudo sysctl -p

This should display the attend lines ...

You can verify that IPV6 is disabled by running the command
ip addr

Now that IPV6 is disabled run the following command to setup a static address using IPv4
sudo nano /etc/networking/interfaces

The file should tell you that it is using an auto configured IPv6 address for auto eth0
Change the line that reads
iface eth0 inet6 auto

to match the lines below
auto eth0
iface eth0 inet static

Remember that the addresses used above are mine ... replace them with yours 

ctrl  + o to save 
ctrl + x to exit

Now reboot the server....
sudo reboot now

 When you are up and running again, you will have your server using a static IPv4 address. 

No comments: