Configure Network in Ubuntu 14.04 / Linux Mint

ADVERTISEMENT

Configure Network in Ubuntu 14.04
Configure Network in Ubuntu 14.04

Just after the installation of Ubuntu 14.04 / 14.10, you must configure network in order to access your system from outside. This guide helps you to configure network in Ubuntu / Linux Mint. Here i will show you assigning ipaddress in Static and in DHCP mode .

Note: This should also work on previous versions of Ubuntu such as Ubuntu 13.10 / 13.04 / 12.10 and LinuxMint 17 / 16.

ADVERTISEMENT
Article will continue after the ad

Static Mode:

In this mode, we will manually assign ipadress to machines. Lets check the available interfaces on our system.

raj@ubuntu:~$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:0c:29:55:f6:b8 brd ff:ff:ff:ff:ff:ff

From the above output, you can see my system has two interfaces namely “lo” and “eth0“. Depends on hardware, name of the interface will change.

Now, we will set ipaddress to an interface “eth0“. To do that, add the “static” method to the inet address family statement for the “eth0” interface in the file /etc/network/interfaces. Change the address, netmask, and gateway values to meet the requirements of your network.

raj@ubuntu:~$ sudo nano /etc/network/interfaces

Just modify the lines like this.

auto eth0
iface eth0 inet static ## Static IP Address Enabled
           address 192.168.12.10  ## IP Address
           netmask 255.255.255.0  ## Subnet Mask
           gateway 192.168.12.2  ## Default Gateway
           dns-nameservers 8.8.8.8 8.8.4.4  ## DNS Servers
           dns-search itzgeek.local  ## Local Domain Search - Ignore if not required

By adding an interface configuration as shown above, you can manually enable the interface through the ifup command.

raj@ubuntu:~$ sudo ifup eth0

To manually disable the interface, you can use the ifdown command.

raj@ubuntu:~$ sudo ifdown eth0

Now you can see the ip address “192.168.12.10” assigned to the interface “eth0“.

raj@ubuntu:~$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:55:f6:b8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.12.10/24 brd 192.168.12.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe55:f6b8/64 scope link
       valid_lft forever preferred_lft forever

DHCP Mode:

In this mode, system will get ipadress from DHCP servers. Lets check the available interfaces on your system.

raj@ubuntu:~$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:0c:29:55:f6:b8 brd ff:ff:ff:ff:ff:ff

From the above output, you can see my system has two interfaces namely “lo” and “eth0“. Depends on hardware, name of the interface will change.

Now, we will set ipaddress to an interface “eth0“. To do that, add the “dhcp” method to the inet address family statement for the “eth0” interface in the file /etc/network/interfaces. Change the address, netmask, and gateway values to meet the requirements of your network.

raj@ubuntu:~$ sudo nano /etc/network/interfaces

Just modify the lines like this.

auto eth0
iface eth0 inet dhcp  ## Enabled DHCP Mode

By adding an interface configuration as shown above, you can manually enable the interface through the ifup command.

raj@ubuntu:~$ sudo ifup eth0

To manually disable the interface, you can use the ifdown command.

raj@ubuntu:~$ sudo ifdown eth0

Now you can see the ip address “192.168.12.3” assigned to the interface “eth0” using dhcp .

raj@ubuntu:~$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:55:f6:b8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.12.3/24 brd 192.168.12.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe55:f6b8/64 scope link
       valid_lft forever preferred_lft forever

Thats All.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

Shares