Linux networking commands
linux networking commands

Linux networking commands

Linux networking commands Linux provides a lot of networking commands so that you can look, and change the IP in Linux. With the ifconfig command, you can do a lot of networking work, but nowadays this command has become very outdated for Linux, the Linux community has developed many such new and powerful methods for networking.
The IP command allows the user and system admin they can configure IP addresses, routing policies, and network interfaces in the system as per their requirement and can also change their policy and service if required.

 Check IP Addresses their Properties for All connected Network device in Linux

With the help of the below command, you can check the IP address and other related network information properties. The output from this command remains the same as the output of ifconfig in Linux. You can also use an in the short in place of addr this will also give you the same result as the addr.

Check IP Addresses their Properties for All connected Network device in Linux

You can also use a in the short in place of addr this will also give you the same result as the addr. For example, you can see the screen below. In the result below the screen, you can see all the connected network interfaces and their properties. The IP of the interface is denoted from inet

show IP in Linux networking command

Check Specific Devices IP Addresses and Properties

If more than one network card is installed in your system and you want to check the properties of one interface, then you can see it very easily with the dev option as given below.

#ip a show dev enp0s3

#ip addr show dev enp0s3

check specific device IP address in Linux networking command

In the above screen, we saw that there were two network cards in the system, but we only had to see the information of the enp0s3 interface, so with the help of the dev option, we got only that information. You can give any interface name that is connected to your system.

also check this

What is Virtualization

how to install apache in ubuntu 20.4

Bluetooth earphone

डाटाबेस क्या है

get only IPv4 Information

if you want to get information only ipv4 and do not want to see any other information like ipv6 then you can use the following command. for reference, you can look at the below screen. You can use any of the following commands.

#ip -4 addr show

#ip -4 addr

get only Ipv4 related information in Linux networking command

 get only IPv6 Information

You can also get information related to ipv6 with the same command as in the previous command we used -4 for ipv4 now you can use -6 for ipv6. See below for an example.

#ip -6 addr

get only Ipv6 related information in Linux networking command

get Colorful Output

If you want to see the output IP address result in ipv4 or ipv6 in the color format then you can use the -c option as you can see on the screen below.

get Colorful  Output

get help with Linux networking commands

With the help of man or manual page, you can get any information related to the network and IP in Linux in depth with options and syntax. You can use the following command to get the information related to the Linux networking

#man ip

#man ip-address

#man ip-link

Get help for Linux networking command

Rename Network Interfaces

With the help of the Linux IP command, you can easily change the name of the network interface card which was installed in your system as you can look in the step below.

Rename Network Interface card in Linux Networking Command

For example, the screen above showed that the network interface was first named enp0s3 and later changed to eth0. To change the name of a network interface card in Linux, first down the network card which card you want to rename, then rename it with the help of command, and then up it again. As you can see on the screen

Change device MAC Address Linux networking commands

If you want to change the mac address of the network interface card in Linux, you can do it very easily for this process first down the network device which you want to change and then change the mac address and again up the Network Device. For example, you can see the screen below.

#ip link set dev eth0 down

now you can change the mac address of the interface with the help of the below command. If the mac address of your system becomes successful change then you can again up that network interface

#ip link set dev eth0 address 18-DB-F2-0C-BF-13

#ip link set dev eth0 up

Change Mac Address in Linux Networking Command

List all Enabled Interfaces

If more than one interface card has been installed in your system and you want to see all the interface devices that are up, then you can use the following command. The most frequent use of this command in troubleshooting of the system or system auditing. for more information, you can run the below command in your system.

#ip link ls up

Get All Up Network Interface in Linux command

With the command we used above, you can get the information of the interface devices that are up in the system, if you want to get the information in more detail about up devices in the system then you can use the -d flag. See the screen below for an example.

#ip -d link ls up

Show All Up network device in Linux

Add an IP Address in Linux

The Linux IP command is a very useful command for both system administrators and network administrators. With this, you can assign IP to any system. Here we will discuss how to assign an IP address to any network device. For example, you can see the command and screenshot given below.

Add Ip Address in Linux networking command

In the above command and screenshot, you can see that we gave 192.168.1.50 IP address to the enp0s8 network device and also gave it a netmask of 24. You can give the network device IP address, netmask according to your system

 Add a Broadcast Address in the Linux networking commands

Earlier we had to add an IP address in the network device but now we will have to add a broadcast address to the network interface device.
The broadcast address sends network packets to each network interface device that connected to the network. For this, you can set the broadcast address according to your network. Two commands are given to add the broadcast address in Linux, you can use any one of them.

#ip addr add brd 192.168.1.255 dev enp0s3

#ip addr add broadcast 192.168.1.255 dev enp0s3

In the above command, you can see that the network device enp0s3 has set the 192.168.1.255 broadcast address. You can set the address according to your network

Delete an IP Address in the Linux network commands

With the help of a Linux command, you can delete the IP address of any network interface in a simple way. You can see on the screen below that I have deleted 192.168.1.50 IP from the system.

Delete IP address in Linux Network command

Enable a Specific Network Interface

If your system has many network devices, and want to start only one specific network device then you can do the following command

Up a specific Network Device In Linux

In the screen above, you can see that I have up the enp0s3 network device

Disable a Specific Network Interface in Linux

In the same way, as you did a network device with the above command, you can down any network device, just as I have downed the enp0s8 device. It is a networking troubleshooting command where there are too many network cards are connected in your system and you want to turn on or off one of them without turning off all network cards.

what we learned

In this article, we have tried to learn in detail about Linux networking commands and hope that now you will have cleared many doubts related to networking in Linux.
If you have any doubt about this article, you can ask your questions through comments or mail. Your questions will help to make our website better.

Leave a Reply