- Linux networking commands
- Check IP Addresses their Properties for All connected Network device in Linux
- Check Specific Devices IP Addresses and Properties
- get only IPv4 Information
- get only IPv6 Information
- get Colorful Output
- get help with Linux networking commands
- Rename Network Interfaces
- Change device MAC Address Linux networking commands
- List all Enabled Interfaces
- Add an IP Address in Linux
- Add a Broadcast Address in the Linux networking commands
- Delete an IP Address in the Linux network commands
- Enable a Specific Network Interface
- Disable a Specific Network Interface in Linux
- what we learned
- Please Share This Share this content
- You Might Also Like
- CentOS vs Ubuntu
- What is Linux Copy Command How To Use Step By Step
- Как настроить BROADCAST.
- Re: Как настроить BROADCAST.
- Re: Как настроить BROADCAST.
- Re: Как настроить BROADCAST.
- local network: how to change broadcast address (with GUI)
- Is there a way, to change the broadcast address for network config via GUI?
- edit
- edit 2
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.
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
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.
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.
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.
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.
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 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
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.
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
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.
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.
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.
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.
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
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.
Please Share This Share this content
- Opens in a new window Twitter
- Opens in a new window Facebook
- Opens in a new window Pinterest
- Opens in a new window LinkedIn
- Opens in a new window WhatsApp
You Might Also Like
CentOS vs Ubuntu
25 June 2021
What is Linux Copy Command How To Use Step By Step
2 March 2022
Как настроить BROADCAST.
DHCP не раздает адресса :(. В HOWTO питется: route add -host 255.255.255.255 dev eth0 проходит нормально route add -net 255.255.255.0 dev eth0 выдает ошибку «SIOCADDRT: Invalid argument» подскажите как с этим справиться? Мот кто наступал на эти грабли?
Re: Как настроить BROADCAST.
Позвольте воспользоваться случаем и написать еще один ворсоп: во-первых у меня подобное несчастье, во-вторых в моей route table появился клевый маршрут: 127.0.0.0 — 255.0.0.0 ! — — — — (минусы: gateway MSS window irtt iface — соответственно; !: flags) — получено командой netstat -r. Появилось это после инсталляции нового kernel 2.2.10 в RH 5.2. И ведь удалить-то никак не могу, т.к. для удаления маршрута треб-ся задавать доп. параметры, если destination присутствует не в единственном числе.
Re: Как настроить BROADCAST.
Так погоди тебе надо broadcast . НО! -net 255.255.255.0 — енто ты указываешь netmask ! На счет удаление не понял. route del 255.0.0.1 чего непомогает чтоли .
Re: Как настроить BROADCAST.
Если последнее замечание по поводу моего вопроса, то во-первых, видимо, не «route del 255.0.0.1», a «route del 127.0.0.1», а во-вторых попробуй-ка этим способом удалить destination x.x.x.x, когда у тебя таких же x.x.x.x еще несколько, да к тому же gateway=-, flags=!, . и напоследок SIOCDELRT: No such process! Тута востроумие трэба.
local network: how to change broadcast address (with GUI)
Is there a way, to change the broadcast address for network config via GUI?
- IP-Address: 192.168.0.5
- Broadcast-Address: 192.168.1.255
- Subnet mask: 255.255.255.0
- Gateway: 192.168.1.1
- Primary DNS: 192.168.1.1
- Secondary DNS: 192.168.0.1
If I set it to «manual» and fill out:
. with the information from above (exept IP address: 192.168.0.222), the connection won’t establish and «Broadcast-Address» differs:
Aim: I want to access my desktop ubuntu with my phone within the local network. Therefore my pc needs a static IP and the broadcast address is wrong, right?
edit
breaker222@breaker222-ubuntu-studio:~$ ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.247 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.301 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.331 ms 64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.294 ms 64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.289 ms 64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=0.297 ms 64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=0.256 ms 64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=0.940 ms ^C --- 192.168.1.1 ping statistics --- 8 packets transmitted, 8 received, 0% packet loss, time 6999ms rtt min/avg/max/mdev = 0.247/0.369/0.940/0.217 ms
edit 2
I’ve solved my problem, by creating a fix-ip-rule (ger: «feste IP Adresse») for my pc within my router options. To do so, I’ve entered the gateway IP «192.168.1.1» in my browsers address bar and navigated to the «Network > LAN» Menu, where I’ve found the Option — and all without the need of console usage 🙂