Linux Networking Commands

Best 20 Useful Linux Networking Commands

In this Post, we will show Old and New  linux network commands that would help you configure or troubleshoot network-related problems in Linux.

Old Command

ifconfig -a

ifconfig (interface configurator) is basic and commonly used commands for finding network details on Linux system. It is also used to configure network interface parameters. We can use this command to get the IP address, MAC address, etc. 

linux network commands

Interface Down command

Run the below command to bring down the enp0s3 interface in the system.

  • # ifconfig enp0s3 down

Interface UP command

Run the below command to bring up the enp0s3 interface in the system.

  • # ifconfig enp0s3 up

IP address Add command

Run the below command to add the IP address on linux server online.

  • # ifconfig enp0s3 192.168.56.104

Netmask Add command

Run the below command to add the netmask address on linux server online.

  • # ifconfig enp0s3 netmask 255.255.255.0

Virtual IP Address Add command

Run below command to add Virtual IP Address in Linux operating systems.

  • # ifconfig enp0s3:1 192.168.56.105 netmask 255.255.255.0

Netstat

Run the below command to show network status and protocol statistics. This command will be display the status of TCP and UDP endpoints in table format, routing table information, and interface information.

  • # netstat
  •  # netstat -tulpn
  • # netstat -neopa
  • # netstat -g

Route

Run the below command to show routing table. Route command will help you to view, add and delete IP routing table in Linux.

  • # route

Below command is route add command.

  •   # route add -net 192.168.56.0 netmask 255.255.255.0 dev enp0s3

Below command is  add default getway  via route.

  • # route add default gw 192.168.56.1

Below command will help you to remove static route.

  • # route delete 192.168.56.255 netmask 255.255.255.0 192.168.56.1

New Command

ip a

Now days we are using “ip a” commands for finding network details on Linux system. It is also used to configure network interface parameters. We can use this command to get the IP address, MAC address, etc.

 

linux network commands

Interface Down new command

Run the below command to bring down the enp0s3 interface in the system.

  • # ip link set  enp0s3 down

Interface UP new command

Run the below command to bring up the enp0s3 interface in the system.

  • # ip link set enp0s3 up

IP address Add new command

Run the below command to add the IP address on linux server online.

  • # ip addr add 192.168.56.104/24 dev enp0s3

Virtual IP Address Add new command

Run below command to add Virtual IP Address in Linux operating systems.

  • # ip addr add 192.168.56.105/24 dev enp0s3

Netstat

Run the below command to show network status and protocol statistics. This command will be display the status of TCP and UDP endpoints in table format, routing table information, and interface information.

  • # ss
  •  # ss -tulpn
  • # ss -neopa
  • # ss -g

Route

Run the below command to show routing table. Route command will help you to view, add and delete IP routing table in Linux.

  • # route

Below command is route add command.

  •   # ip route add  192.168.56.0/24 dev enp0s3

Below command is  add default getway  via route.

  • # ip route add default via 192.168.56.1

Below command will help you to remove static route.

  • # ip route delete 192.168.56.1

Leave your message if anything missed and we appreciate your comments. Click Next

Related Posts

Leave a Reply

Your email address will not be published.