Skip to content

Linux Network Commands

Daniel Bezerra edited this page Nov 22, 2018 · 6 revisions

$ifconfig

$ifconfig eth0

Assigning an IP and gateway

$ ifconfig eth0 netmask 255.255.255.0

Enable eth0

$ ifup eth0

Disable eth0

$ ifdown eth0

HOSTNAME

Hostname is to identify in a network. Execute hostname command to see the hostname of your box. You can set hostname permanently in /etc/sysconfig/network (requires reboot). $ hostname

Traceroute

Traceroute is a network troubleshooting utility which shows number of hops taken to reach destination also determine packets traveling path.

$ traceroute

Netstat

Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.

$ netstat -r

DIG

Dig (domain information groper) query DNS related information like A Record, CNAME, MX Record etc. This command mainly use to troubleshoot DNS related query.

$ dig www.uol.com.br

NSLOOKUP

Nslookup command also use to find out DNS related query.

$ nslookup www.uol.com.br

ROUTE Command

Route command also shows and manipulate ip routing table. To see default routing table in Linux, type the following command.

Adding default Gateway

$ route add default gw 192.168.0.1

ARP

ARP (Address Resolution Protocol) is useful to view / add the contents of the kernel’s ARP tables. $ arp -e