This is the blog, how to add new network interface in Linux Ubuntu 16.04 TLS.
For a System Administrator, It is a common task which is required on demand to add additional Network Interface. It may be required for different purpose i.e. Setup Bridge Interface, Setting up VLAN etc.
1 - Requirement :- In my scenario, I am using Ubuntu 16.04 TLS box running on the Virtual box.
2 - Check Current Interfaces :-
We can check current available Network interfaces using below method.
A- Using command ifconfig -a
root@U16:~# ifconfig -a enp0s3 Link encap:Ethernet HWaddr 08:00:27:ae:86:3c inet addr:10.0.0.161 Bcast:10.0.1.255 Mask:255.255.254.0 inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1906 errors:0 dropped:0 overruns:0 frame:0 TX packets:894 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1646594 (1.6 MB) TX bytes:73845 (73.8 KB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:160 errors:0 dropped:0 overruns:0 frame:0 TX packets:160 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
B- Using command ip link
root@U16:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 08:00:27:ae:86:3c brd ff:ff:ff:ff:ff:ff
root@U16:~#
3- Now Add new network interface from Virtual Box.
- Shutdown your VM first
- Select (1) VM Go to VM (2) setting
- Select (1) Network from left side menu, Choose (2) Network adapter 2 , select check box (3) enable network Adapter and Select (4) Bridge Adapter from drop down list Attached to option.
- Click Ok And Start the VM.
4- Check newly added interface :-
root@U16:~# ifconfig -a
enp0s3 Link encap:Ethernet HWaddr 08:00:27:ae:86:3c
inet addr:10.0.0.161 Bcast:10.0.1.255 Mask:255.255.254.0
inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:723 errors:0 dropped:0 overruns:0 frame:0
TX packets:114 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67371 (67.3 KB) TX bytes:16991 (16.9 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:98:ec:88
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
Newly available interface is enp0s8
5- Let's configure enp0s8 interface and activate this adapter:-
Open interfaces from /etc/network location using vi editor. And append below line.
auto enp0s8
iface enp0s8 inet dhcp
root@U16:~# vi /etc/network/interfaces
auto enp0s8
iface enp0s8 inet dhcp
Save and Exit form file.
6- Restart Networking service to apply changes :-
root@U16:~# service networking restart
7- Let's check for IP address :-
Use command ifconfig or ip addr to check assigned IP address.
root@U16:~# ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:ae:86:3c
inet addr:10.0.0.161 Bcast:10.0.1.255 Mask:255.255.254.0
inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6811 errors:0 dropped:0 overruns:0 frame:0
TX packets:381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:627377 (627.3 KB) TX bytes:80855 (80.8 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:98:ec:88
inet addr:10.0.0.81 Bcast:10.0.1.255 Mask:255.255.254.0
inet6 addr: fe80::a00:27ff:fe98:ec88/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2246 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:209378 (209.3 KB) TX bytes:1192 (1.1 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
We have successfully added newly Interface and getting IP address.
That's All
!!!Cheers!!!
No comments:
Post a Comment