1. List all available interface on the system
[root@ashok ~]# nmcli connection show
- only to show active ones
[root@ashok ~]# nmcli connection show -active
NAME UUID TYPE DEVICE
virbr0-nic e9279275-54b8-48ef-a756-d4d714bcd5ac generic virbr0-nic
virbr0 b7af90bc-8003-49df-bf58-4180828be0fd bridge virbr0
Wired connection 2 e3d708dc-aefd-41ea-96d2-81bdd0d307b7 802-3-ethernet ens37
Wired connection 1 8b3b2e8a-1e5d-4982-93d0-77f7fe4eba6a 802-3-ethernet ens38
default 4f8fe83d-df38-4441-83ae-0d400f76c43d 802-3-ethernet ens33
- list all configuration setting for the interace
[root@ashok ~]# nmcli con show "Wired connection 1"
connection.id: Wired connection 1
connection.uuid: 8b3b2e8a-1e5d-4982-93d0-77f7fe4eba6a
connection.interface-name: --
connection.type: 802-3-ethernet
connection.autoconnect: yes
- [root@ashok ~]# nmcli dev status
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
ens33 ethernet connected default
ens37 ethernet connected Wired connection 2
ens38 ethernet connected Wired connection 1
virbr0-nic tap connected virbr0-nic
lo loopback unmanaged --
- display device status
[root@ashok ~]# nmcli dev show ens38
GENERAL.DEVICE: ens38
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:80:C1:E6
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: Wired connection 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.10.17/24
IP4.GATEWAY: 192.168.10.1
IP4.DNS[1]: 192.168.10.1
IP6.ADDRESS[1]: fe80::20c:29ff:fe80:c1e6/64
IP6.GATEWAY:
[root@ashok ~]#
2. Assign static ip/gateway/dns on one of the interface
- adding ip/gateway
[root@ashok ~]# nmcli con add con-name eth-ens38 ifname ens38 type ethernet ip4 192.168.10.220/24 gw4 192.168.10.1
Connection 'eth-ens38' (23d86e57-2fae-480f-8015-4ea7a8539812) successfully added.
[root@ashok ~]#
- adding nameserver
[root@ashok ~]# nmcli con mod "eth-ens38" ipv4.dns 192.168.10.110
3. Bring up the interface.
- list connections on the system
[root@ashok ~]# nmcli connection show
NAME UUID TYPE DEVICE
eth-ens38 23d86e57-2fae-480f-8015-4ea7a8539812 802-3-ethernet --
Wired connection 1 8b3b2e8a-1e5d-4982-93d0-77f7fe4eba6a 802-3-ethernet ens38
15dd-442e-bc69-25c5bf2c1b6b 802-3-ethernet --
- bring up the interface
[root@ashok ~]# nmcli con up eth-ens38
- list the active interface
[root@ashok ~]# nmcli con show --active
NAME UUID TYPE DEVICE
eth-ens38 23d86e57-2fae-480f-8015-4ea7a8539812 802-3-ethernet ens38
- verify the ip address
[root@ashok ~]# ip addr show ens38
4: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:80:c1:e6 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.220/24 brd 192.168.10.255 scope global ens38
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe80:c1e6/64 scope link
valid_lft forever preferred_lft forever
[root@ashok ~]#
4. Reboot the system and verify that your assigned ip address is still available.
- upon rebooting the system, verify the ip address is available.
# ifconfig -a
# ip addr show
[root@ashok ~]# ip route
default via 192.168.10.1 dev ens33 proto static metric 100
192.168.10.0/24 dev ens38 proto kernel scope link src 192.168.10.220 metric 102
[root@ashok ~]#
[root@ashok ~]# ping -c 2 yahoo.com
PING yahoo.com (98.138.253.109) 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=1 ttl=52 time=53.9 ms
No comments:
Post a Comment