0% found this document useful (0 votes)
2 views

Exp1 Commands

The document outlines basic network configuration commands and files in Linux, focusing on the usage of 'netstat' and 'ifconfig' for network management. It also explains the purpose of key configuration files like /etc/hosts and /etc/resolv.conf, as well as the ARP protocol for finding MAC addresses. Additional commands such as 'tcpdump' and 'nslookup' are mentioned for capturing packets and querying DNS information, respectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Exp1 Commands

The document outlines basic network configuration commands and files in Linux, focusing on the usage of 'netstat' and 'ifconfig' for network management. It also explains the purpose of key configuration files like /etc/hosts and /etc/resolv.conf, as well as the ARP protocol for finding MAC addresses. Additional commands such as 'tcpdump' and 'nslookup' are mentioned for capturing packets and querying DNS information, respectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Experiment 1

To get familiarized with the basics of network configuration


files and networking commands in Linux
a. View the configuration, including addresses of your computers
network interfaces.

• Two basic commands are provided by most Unix systems for network configuration and
administration, and can be used to discover some details of a network: netstat and ifconfig.
• netstat
• netstat command displays various network related information such as network connections,
routing tables, interface statistics, masquerade connections, multicast memberships etc.
• netstat -a : To show both listening and non-listening sockets.
• netstat -at : To list all tcp ports
• netstat -au : To list all udp ports
• netstat -l : To list only the listening ports.
• netstat -lt : To list only the listening tcp ports
• netstat -lu : To list only the listening udp ports
• netstat -lx : To list only the listening UNIX ports
• netstat -s : To list the statistics for all ports
• netstat -st : To list the statistics for TCP ports.
• netstat -su : List the statistics for UDP ports
• netstat -pt : To display the PID and program names
• netstat -c : To print the netstat information continuously
• netstat -r : To get the kernel routing information
• netstat -ap | grep ssh : To get the port on which a program is running.
• netstat -i : To get the list of network interfaces
• netstat -ie : To display extended information on the interfaces
• ifconfig

• used to assign the IP address and netmask to an interface or to enable


or disable a given interface
• ifconfig –a: used to display all the interfaces available, even if they are
down
• ifconfig –s : Display a short list, instead of details.
• ifconfig interface up : used to activate the driver for the given
interface
• ifconfig interface down: used to deactivate the driver for the given
interface
• ifconfig –help : Display help related to ifconfig command
• ifconfig –v : log more details about execution
Network configuration files
• /etc/hosts: The /etc/hosts always contains the localhost IP address,
127.0.0.1, which is used for interprocess communication.
• /etc/resolv.conf: The /etc/resolv.conf configures access to a DNS
server.
• /etc/nsswitch.conf: The /etc/nsswitch.conf defines the order in which
to contact different name services.
• Eg: gedit /etc/hosts
Find the hardware/MAC address of another
computer in the network using ARP
• ARP stands for Address Resolution Protocol. The primary function of
this protocol is to resolve the IP address of a system to its mac address
• arp –a : checking arp for all machines
• arp –v : To find out detailed information about the device and its
entries
• arp –n: to display the above output in numeric form
Additional commands
• tcpdump : used to capture or filter TCP/IP packets that are received or
transferred over a network on a specific interface
• sudo tcpdump : To capture the packets of current network interface
• sudo tcpdump -D: To display all available interfaces
• nslookup : a useful command for getting information from the DNS
server.
• Eg: nslookup google.com

You might also like