The ip command is a new networking control-line utility that is used to assign an IP accost to a network interface or configure/update useful network variables on a Linux arrangement.
It is a function of the iproute2 parcel and offers several network administration tasks such every bit bringing up or down network interfaces, assign and remove IP addresses and routes, manage ARP enshroud, and much more.
The ip command is much similar to the sometime ifconfig command, but it is greatly more powerful with more functions and capabilities added to it.
[ You might besides like: Deprecated Linux Networking Commands and Their Replacements ]
The ifconfig command has been deprecated and replaced past the ip control in all modern Linux distributions. However, the ifconfig command is withal works and bachelor for most Linux distributions.
[ You might also similar: ifconfig vs ip: What's Departure and Comparing Network Configuration ]
Note: Please have configuration file backup before doing whatsoever changes.
How Exercise I Configure Static IP Accost Net Protocol (IPv4)
To configure static IP Addresses in Linux, you need to update or edit the network configuration file to assign a Static IP Address to a system. Y'all must be a superuser with a su (switch user) command from the terminal or command prompt.
For RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux
Open up and edit the network configuration files for (eth0 or eth1) using your favorite text editor. For example, assigning IP Accost to eth0 interface as follows.
[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Uncomplicated output:
DEVICE="eth0" BOOTPROTO=static ONBOOT=yes TYPE="Ethernet" IPADDR=192.168.l.ii Name="System eth0" HWADDR=00:0C:29:28:FD:4C GATEWAY=192.168.50.ane
For Ubuntu/Debian/Linux Mint
Assign Static IP Address to eth0 interface editing configuration file /etc/network/interfaces to make permanent changes equally shown below.
car eth0 iface eth0 inet static accost 192.168.fifty.2 netmask 255.255.255.0 gateway 192.168.50.1
Adjacent, restart network services later inbound all the details using the following command.
# systemctl restart NetworkManager.service Or # /etc/init.d/networking restart
[ You lot might also like: How to Configure Network Connection Using 'nmcli' Tool ]
1. How to Assign an IP Address to a Specific Interface
The following command is used to assign an IP Addresses to a specific interface (eth1) on the fly.
# ip addr add 192.168.50.five dev eth1
$ sudo ip addr add 192.168.50.v dev eth1
Note: Unfortunately all these settings volition exist lost after a system restart.
2. How to Check an IP Address
To get the depth information of your network interfaces like IP Address, MAC Address information, use the post-obit command as shown below.
# ip addr show
$ sudo ip addr show
Sample Output
1: lo: <LOOPBACK,Upward,LOWER_UP> mtu 16436 qdisc noqueue country UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 telescopic host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,Upward,LOWER_UP> mtu 1500 qdisc pfifo_fast country UNKNOWN qlen 1000 link/ether 00:0c:29:28:fd:4c brd ff:ff:ff:ff:ff:ff inet 192.168.fifty.2/24 brd 192.168.50.255 scope global eth0 inet6 fe80::20c:29ff:fe28:fd4c/64 scope link valid_lft forever preferred_lft forever 3: eth1: <Broadcast,MULTICAST,Upward,LOWER_UP> mtu 1500 qdisc pfifo_fast country UNKNOWN qlen 1000 link/ether 00:0c:29:28:fd:56 brd ff:ff:ff:ff:ff:ff inet 192.168.fifty.5/24 scope global eth1 inet6 fe80::20c:29ff:fe28:fd56/64 telescopic link valid_lft forever preferred_lft forever
3. How to Remove an IP Address
The following command volition remove an assigned IP accost from the given interface (eth1).
# ip addr del 192.168.50.5/24 dev eth1
$ sudo ip addr del 192.168.50.v/24 dev eth1
4. How to Enable Network Interface
The "upwardly" flag with interface proper name (eth1) enables a network interface. For example, the following command will activate the eth1 network interface.
# ip link set eth1 up
$ sudo ip link set up eth1 up
5. How to Disable Network Interface
The "down" flag with interface proper name (eth1) disables a network interface. For example, the following command volition De-activates the eth1 network interface.
# ip link gear up eth1 down
$ sudo ip link fix eth1 down
6. How do I Check Road Table?
Blazon the following control to check the routing table information of the system.
# ip road evidence
$ sudo ip route show
Sample Output
10.10.20.0/24 via 192.168.fifty.100 dev eth0 192.168.160.0/24 dev eth1 proto kernel scope link src 192.168.160.130 metric 1 192.168.50.0/24 dev eth0 proto kernel scope link src 192.168.l.2 169.254.0.0/16 dev eth0 scope link metric 1002 default via 192.168.l.ane dev eth0 proto static
7. How do I Add together Static Route
Why do you demand to add Static routes or Manual routes, because that the traffic must non laissez passer through the default gateway. We demand to add together Static routes to laissez passer traffic from the all-time mode to reach the destination.
# ip route add together x.x.twenty.0/24 via 192.168.50.100 dev eth0
$ sudo ip route add together ten.10.20.0/24 via 192.168.50.100 dev eth0
8. How to Remove Static Route
To remove the assigned static route, simply blazon the following command.
# ip route del x.10.20.0/24
$ sudo ip road del 10.10.20.0/24
9. How do I Add Persistence Static Routes
All the to a higher place routes will exist lost after a system restart. To add together permanent Static route, edit file /etc/sysconfig/network-scripts/route-eth0 (We are storing static route for (eth0).
For RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux
# half-dozen /etc/sysconfig/network-scripts/road-eth0
and add the following lines and save and leave. Past default road-eth0 file will non be at that place, need to be created.
x.10.20.0/24 via 192.168.fifty.100 dev eth0
For Ubuntu/Debian/Linux Mint
Open up the file /etc/network/interfaces and at the end add together the persistence Static routes. IP Addresses may differ in your surround.
$ sudo half dozen /etc/network/interfaces
auto eth0 iface eth0 inet static address 192.168.fifty.2 netmask 255.255.255.0 gateway 192.168.50.100 #########{Static Route}########### up ip route add x.10.20.0/24 via 192.168.50.100 dev eth0
Next, restart network services after entering all the details using the following command.
# systemctl restart NetworkManager.service Or # /etc/init.d/networking restart
x. How practise I Add Default Gateway
The default gateway can exist specified globally or for interface-specific config files. The advantage of the default gateway is If we have more than one NIC is present in the organization. Yous can add the default gateway on the wing as shown below the command.
# ip route add default via 192.168.l.100
$ sudo ip route add together default via 192.168.l.100
Kindly correct me if I missed out. Please refer manual folio doing man ip from terminal/command prompt to know more than most IP Control.
If You Capeesh What We Do Hither On TecMint, Yous Should Consider:
TecMint is the fastest growing and virtually trusted community site for whatsoever kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If y'all like what you are reading, please consider buying us a java ( or 2 ) every bit a token of appreciation.
We are thankful for your never ending support.
DOWNLOAD HERE
How to Make an Ip Address on Minecraft TUTORIAL
Posted by: kennethunter1946.blogspot.com
Comments
Post a Comment