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

From Notes_Wiki
(Created page with "<yambe:breadcrumb>CentOS_7.x_network_management|CentOS 7.x network management</yambe:breadcrumb> =CentOS 7.x ip command= ==Add static IP to IPv4 interface using ip command==...")
 
m
 
(4 intermediate revisions by the same user not shown)
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=
 
'''More updated articles on this are at:''':
* [[CentOS 8.x iproute2 basics]]
* [[OpenSuse Leap 15 iproute2 basics]]
 
 


==Add static IP to IPv4 interface using ip command==
==Add static IP to IPv4 interface using ip command==
Line 20: Line 25:
</pre>
</pre>


==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:
<pre>
  ip route show
</pre>
To increase priority of a gateway, add it again using:
<pre>
  ip route add default via 172.16.1.1 dev wlp3s0 proto static metric 50
</pre>
Note that having two default routes for 172.16.1.1 with two different metrics is not a problem.




Line 25: Line 43:




<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]]

Latest revision as of 06:39, 25 August 2022

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

More updated articles on this are at::


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