How to assign Static/Manul IP Address in Ubuntu 16.10/Linux Mint

Check IP address and interface status
$ ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.65  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::b96a:79ec:ddc4:2a0f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:42:7e:c9  txqueuelen 1000  (Ethernet)
        RX packets 2928  bytes 239502 (239.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 882  bytes 79189 (79.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  base 0x2000

Note: Interface/LAN interface name is ens33
Before configuring manual IP address in system , you need to disable NetworkManager service (GUI)

Edit file /etc/network/interfaces to configure static/manually ip address

$ sudo vim /etc/network/interfaces
 # interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#====Change Parameter for 1st interface============#
auto ens33
iface ens33 inet static
    address 192.168.0.70
    netmask 255.255.255.0
    gateway 192.168.0.254
    dns-nameservers 8.8.8.8 4.4.2.2

Start networking service
$ sudo systemctl start networking
$ sudo systemctl enable networking

Now reboot system 
$ sudo reboot

After reboot check ip status
$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.70  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe42:7ec9  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:42:7e:c9  txqueuelen 1000  (Ethernet)
        RX packets 3007  bytes 271704 (271.7 KB)
        RX errors 0  dropped 10  overruns 0  frame 0
        TX packets 300  bytes 32889 (32.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  base 0x2000

Assign IP address on another interface
Edit networking config file and below parameter
$ sudo vim /etc/network/interfaces
#====Change Parameter for 2nd interface============#auto ens38
iface ens38 inet static
    address 192.168.1.70
    netmask 255.255.255.0


Restart networking service
$ sudo systemctl restart networking
Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment