Difference between revisions of "CentOS 7.x ip command"

From Notes_Wiki
m
m
Line 1: Line 1:
<yambe:breadcrumb>CentOS_7.x_network_management|CentOS 7.x network management</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x system administration|System Administration]] > [[CentOS 7.x network management|Network management]] > [[CentOS 7.x ip command]]
=CentOS 7.x ip command=


==Add static IP to IPv4 interface using ip command==
==Add static IP to IPv4 interface using ip command==
Line 38: Line 37:




<yambe:breadcrumb>CentOS_7.x_network_management|CentOS 7.x network management</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x system administration|System Administration]] > [[CentOS 7.x network management|Network management]] > [[CentOS 7.x ip command]]

Revision as of 06:37, 25 August 2022

Home > CentOS > CentOS 7.x > System Administration > Network management > CentOS 7.x ip command

Add static IP to IPv4 interface using ip command

In CentOS 7.x multiple IPv4 addresses can be associated with same interface without needing aliases (eth0:0). The older ifconfig command will show only one of these multiple addresses.

Hence use following command to check interface ip addresses:

   ip addr show

Add IP to interface using:

   ip address add 10.90.144.251/21 dev enp0s25

Similarly existing IP can be removed using

ip add del 10.0.0.0/21 dev enp0s25


Increase priority of preferred default gateway using ip command

If there are multiple connections, eg one wireless and one wired, then we can choose preferred network (default-gateway) using ip command. For this, to check existing priorities use:

   ip route show

To increase priority of a gateway, add it again using:

   ip route add default via 172.16.1.1 dev wlp3s0 proto static metric 50

Note that having two default routes for 172.16.1.1 with two different metrics is not a problem.



Home > CentOS > CentOS 7.x > System Administration > Network management > CentOS 7.x ip command