Linux Networking Commands

Slides:



Advertisements
Similar presentations
21.1 Chapter 21 Network Layer: Address Mapping, Error Reporting, and Multicasting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Advertisements

Precept 3 Host Configuration 1 Peng Sun. What TCP conn. running? Commands netstat [-n] [-p] [-c] (Linux) lsof -i -P (Mac) ss (newer version of netstat)
SYSTEM ADMINISTRATION Chapter 19
Linux network troubleshooting If your network connection is not working..
Chapter 13: Troubleshooting network connectivity Unit objectives Identify TCP/IP troubleshooting tools Discuss the Telnet utility and its functions Discuss.
1 Linux Networking and Security Chapter 2. 2 Configuring Basic Networking Describe how networking devices differ from other Linux devices Configure Linux.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 13: Troubleshoot TCP/IP.
Overview of TCP/IP Protocols
Recursive Server. Overview Recursive Service Root server list localhost in-addr.arpa named.conf.
Network Management And Debugging
Network Debugging Organizational Communications and Technologies Prithvi Rao H. John Heinz III School of Public Policy and Management Carnegie Mellon University.
Common network diagnostic and configuration utilities A ‘toolkit’ for network users and managers when ‘troubleshooting’ is needed on your network.
Linux Setting up your network. Basic Approaches Configure during installation –Disadvantage -> not able to redo easily –Advantage-> holds your hand Configure.
TCP/IP Tools Lesson 5. Objectives Skills/ConceptsObjective Domain Description Objective Domain Number Using basic TCP/IP commands Understanding TCP/IP3.6.
Click to edit Master subtitle style Chapter 17: Troubleshooting Tools Instructor:
1 Chapter Overview TCP/IP Services TCP/IP Utilities.
System Administration Network Tools. ping Test connectivity / latency (RTT) ICMP echo request/reply Variants ◦ARP ping  Send ARP instead  May also ping.
ARP Under Normal Conditions. The basics arp with reverse DNS lookup for each IP arp –a # Windows & linux Without reverse DNS lookup (runs faster) arp.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 7 Connect the SUSE Linux Enterprise Server to the Network.
Chapter 12: Configuring Networks The Complete Guide to Linux System Administration.
TCP/IP Networking sections 13.2,3,4,5 Road map: TCP, provide connection-oriented service IP, route data packets from one machine to another (RFC 791) ICMP,
Chapter Twelve Using TCP/IP on the Network. Objectives Here, we’ll examine how to configure TCP/IP. The concepts of subnetting will be examined in detail.
CCNA Introduction to Networking 5.0 Rick Graziani Cabrillo College
Linux Filesystem Management
Module 7: Configuring TCP/IP Addressing and Name Resolution.
Hands-on Networking Fundamentals
Managing Network connections. Network Cabling Ethernet Topology Bus topology – Connects each node in a line – Has no central connection point Star topology.
Exercises ARP ICMP DNS HTTP/TCP Trace analysis. ARP launch Wireshark ipconfig /all ; see local IP and gateway route -print ; find gateway arp -a ; list.
Herramientas para diagnósticos. Ping USO: Ping nombre.dominio o dirección IP Options: -t Ping the specifed host until interrupted. -a Resolve addresses.
Network Troubleshooting
Troubleshooting. Why Troubleshoot? What Can Go Wrong? –Misconfigured zone –Misconfigured server –Misconfigured host –Misconfigured network.
Mr. Mturi Elias University Computing Centre SYSTEMS ADMIN TRAINING WORKSHOP.
Network Tools TCP/IP interface configuration query - MAC (HW) address and IP address – Linux - /sbin/ifconfig – MS Windows – ipconfig/all 1.
DNS Related Commands Sayed Ahmed Computer Engineering, BUET, Bangladesh (Graduated on 2001 ) MSc, Computer Science, U of Manitoba, Canada
Institute of Technology Sligo - Dept of Computing Semester 2 Chapter 10 IP Addressing.
Examining TCP/IP.
IP Forwarding.
1 IP: putting it all together Part 1 G53ACC Chris Greenhalgh.
Copyright © Lopamudra Roychoudhuri
CDPA 網管訓練 駭客任務 2 Ethernet Switching ARP, IP, LAN, Subnet IP Header, Routing ICMP
1 Tutorial 6: Networking Utilities & Firewall. 2 Internet Control Message Protocol (ICMP) designed to compensate for the deficiencies of IP protocol.
Module 8 DNS Tools & Diagnostics. Objectives Understand dig and nslookup Understand BIND toolset Understand BIND logs Understand wire level messages.
Linux Network Management Command. (1) Domainname Command Name :- domainname Purpose:- Displays or sets the name of the current Network Information Service(NIS)
Day 14 Introduction to Networking. Unix Networking Unix is very frequently used as a server. –Server is a machine which “serves” some function Web Server.
1 TCP/IP Networking. 2 TCP/IP TCP/IP is the networking protocol suite most commonly used with UNIX, Windows, NT and most other OS’s. TCP/IP defines a.
1 Internet Tool Practice 한두균 송정환
1 Internet Control Message Protocol (ICMP) Used to send error and control messages. It is a necessary part of the TCP/IP suite. It is above the IP module.
1 COP 4343 Unix System Administration Unit 11: Networking – basic concepts: IP, TCP, UDP, DHCP – devices: setup, status.
Linux Setting up your network. Basic Approaches Configure during installation –Disadvantage -> not able to redo easily –Advantage-> holds your hand Configure.
IP network tools & troubleshooting AFCHIX 2010 Nairobi, Kenya October 2010.
Sniffer, tcpdump, Ethereal, ntop
Monitoring Troubleshooting TCP/IP Chapter 3. Objectives for this Chapter Troubleshoot TCP/IP addressing Diagnose and resolve issues related to incorrect.
Basic Linux Router I Router, a device that... Working on OSI Layer 3 (Network Layer) Connected to more than one networks Finding.
Linux Operations and Administration Chapter Eight Network Communications.
Semester 2v2 Chapter 8: IP Addressing. Describe how IP addressing is important in routing. IP addresses are specified in 32-bit dotted-decimal format.
ERICSON BRANDON M. BASCUG Alternate - REGIONAL NETWORK ADMINISTRATOR HOW TO TROUBLESHOOT TCP/IP CONNECTIVITY.
1 DETAILS OF PROTOCOLS The Zoo Protocol - TCP - IP.
Fall 2011 Nassau Community College ITE153 – Operating Systems 1 Session 9 Networking & Operating Systems (part 2)
Chapter 4: server services. The Complete Guide to Linux System Administration2 Objectives Configure network interfaces using command- line and graphical.
Troubleshooting. Why Troubleshoot? What Can Go Wrong? –Misconfigured zone –Misconfigured server –Misconfigured host –Misconfigured network.
LINUX Network Concepts M.S.Dibay Moghaddam Second Linux Festival Amir Kabir University of Technology Computer & IT Department.
Ifconfig Kevin O'Brien Washtenaw Linux Users Group
Victoria Manfredi September 13, 2016.
Linux network troubleshooting
Click to edit Master subtitle style
Network Configuration
Network Commands 2 Linux Ubuntu A.S.
Network Tools and Utilities
Linux Ubuntu Network Commands 3 A.S.
Introduction to Networking
Presentation transcript:

Linux Networking Commands

Commands Reviewed Ifconfig dmesg netstat ping route tcpdump wireshark traceroute nslookup arp dig

ifconfig ifconfig is used to assign an address to a network interface and/or configure network interface parameters. To determine if an interface has been recognized and configured on a system To initially assign an IP address to an interface to bring an interface up or down

View All Network Setting The “ifconfig” command with no arguments will display all the active interfaces details.

Display Information of All Network Interfaces ifconfig command with -a argument will display information of all active or inactive network interfaces on server.

ifconfig View Network Settings of Specific Interface Enable an Network Interface

ifconfig Assign a IP Address to Network Interface [root@tecmint ~]# ifconfig eth0 172.16.25.125 Assign a netmask to Network Interface [root@tecmint ~]# ifconfig eth0 netmask 255.255.255.224 Assign a Broadcast to Network Interface [root@tecmint ~]# ifconfig eth0 broadcast 172.16.25.63 Assign all in one command [root@tecmint ~]# ifconfig eth0 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63 Change the MAC address of Network Interface [root@tecmint ~]# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF

ifconfig Change MTU for an Network Interface [root@tecmint ~]# ifconfig eth0 mtu 1000 Enable and disablePromiscuous Mode [root@tecmint ~]# ifconfig eth0 promisc [root@tecmint ~]# ifconfig eth0 –promisc Add or remove New Alias to Network Interface [root@tecmint ~]# ifconfig eth0:0 172.16.25.127 [root@tecmint ~]# ifconfig eth0:0 down Verify the newly created alias network interface address [root@tecmint ~]# ifconfig eth0:0 eth0:0 Link encap:Ethernet HWaddr 00:01:6C:99:14:68 inet addr:172.16.25.123 Bcast:172.16.25.63 Mask:255.255.255.240 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:17

See if the device has been found - use dmesg The command 'dmesg', which is used to print kernel messages, is very useful in determining if a piece of hardware has been found, and if so, what the system is referring to it as. Examples: dmesg dmesg | grep -i eth0 dmesg | grep -i usb dmesg | grep -i Memory dmesg | grep -i bluetooth dmesg | grep -i tty dmesg –c clear dmesg logs from boot time to till that time

ping Confirm that a remote host is online and responding. ping is intended for use in network testing, measurement, and management. It is unwise to use ping during normal operations or from automated scripts.

Decrease /Increase Ping Time Interval $ ping -i 5 IP # ping -i 0.1 IP Note: Only super user can specify interval less than 0.2 seconds. Check local interface $ ping 0 $ ping localhost $ ping 127.0.0.1 Send n packets and stop: $ ping -c 5 google.com Display the current version of ping program $ ping -V

Ping 5. Flood the network Audible ping: Change Ping Packet Size # ping -f localhost Audible ping: $ ping -a IP Change Ping Packet Size $ ping -s 100 localhost Specify path for ping to send the packet $ ping 192.168.3.33 192.168.7.1 192.168.4.45 Record and print route of how ECHO_REQUEST sent and ECHO_REPLY received $ ping -R 192.168.1.63

Route command Display Existing Routes if the destination is within the network range 192.168.1.0 – 192.168.1.255, then the gateway is *, which is 0.0.0.0. By default route command displays the host name in its output. We can request it to display the numerical IP address using -n option as shown below.

Adding a Default Gateway List Kernel’s Routing Cache Information $ route add default gw 192.168.1.10 List Kernel’s Routing Cache Information Reject Routing to a Particular Host or Network route add -host 192.168.1.51 reject

Note traceroute Traceroute has lost some of traceroute attempts tracing by launching UDP probe packets with a small TTL (time to live), then listening for an ICMP "time exceeded" reply from a gateway. host is the destination hostname or the IP number of host to reach. packetsize is the packet size in bytes of the probe datagram. Default is 38 bytes. Note Traceroute has lost some of its effectiveness since most ISP’s disallow it from running on their networks

netstat List out all connections List only TCP or UDP connections $ netstat –a List only TCP or UDP connections $ netstat –at $ netstat –au Disable reverse dns lookup for faster output: By default, the netstat command tries to find out the hostname of each ip address in the connection by doing a reverse dns lookup. This slows down the output. $ netstat -ant

netstat Print statistic List out only listening connections $ netstat -s List out only listening connections $ netstat –tnl Get process name/pid and user id $ sudo netstat –nlpt Use the e option along with the p option to get the username too. $ sudo netstat -ltpe

netstat -nr [root@localhost root]# netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.2.0 0.0.0.0 255.255.255.0 U 40 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 40 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo 0.0.0.0 192.168.1.1 0.0.0.0 UG 40 0 0 eth1

nslookup Query Internet domain name servers. $ nslookup redhat.com $ nslookup -query=mx redhat.com nslookup -type=ns redhat.com Query the SOA Record using -query=soa provides the authoritative information about the domain, the e-mail address of the domain admin, the domain serial number, etc… $ nslookup -type=soa redhat.com View available DNS records using -query=any $ nslookup -type=any google.com Reverse DNS lookup $ nslookup redhat.com ns1.redhat.com

arp -a [root@localhost root]# arp -a gatewayout.tcp-ip.ca (192.168.1.1) at 00:04:5A:DB:A1:C5 [ether] on eth1 basement.tcp-ip.ca (192.168.2.75) at 00:10:E0:04:61:84 [ether] on eth0 just_a_node.tcp-ip.ca (192.168.1.101) at 00:09:B7:13:AA:13 [ether] on eth1

dig - supercharged nslookup oroot@localhost root]# dig cs.senecac.on.ca ; <<>> DiG 9.1.3 <<>> cs.senecac.on.ca ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10483 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 4 ;; QUESTION SECTION: ;cs.senecac.on.ca. IN A ;; ANSWER SECTION: cs.senecac.on.ca. 86400 IN A 142.204.57.48

dig - better than nslookup ;; AUTHORITY SECTION: senecac.on.ca. 86400 IN NS ns.onet.on.ca. senecac.on.ca. 86400 IN NS ns2.senecac.on.ca. senecac.on.ca. 86400 IN NS hades.senecac.on.ca. senecac.on.ca. 86400 IN NS ittads.senecac.on.ca. senecac.on.ca. 86400 IN NS pulsar.senecac.on.ca. senecac.on.ca. 86400 IN NS nsprime.senecac.on.ca. ;; ADDITIONAL SECTION: ns2.senecac.on.ca. 86400 IN A 142.204.10.100 hades.senecac.on.ca. 86400 IN A 142.204.57.15 ittads.senecac.on.ca. 86400 IN A 142.204.6.57 pulsar.senecac.on.ca. 86400 IN A 142.204.119.97 ;; Query time: 2202 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Sun Sep 29 16:38:20 2002 ;; MSG SIZE rcvd: 238

tcpdump tcpdump is a most powerful and widely used command-line packets sniffer or package analyzer tool which is used to capture or filter TCP/IP packets that received or transferred over a network on a specific interface. # yum install tcpdump $ apt-get install tcpdump Capture Packets from Specific Interface # tcpdump -i eth0 Capture Only N Number of Packets # tcpdump -c 5 -i eth0

Display Available Interfaces Capture and Save Packets in a File # tcpdump –D Capture and Save Packets in a File # tcpdump -w 0001.pcap -i eth0 Read Captured Packets File # tcpdump -r 0001.pcap Capture only TCP packets # tcpdump -i eth0 tcp Capture Packet from Specific Port # tcpdump -i eth0 port 22 Capture Packets from destination /src IP # tcpdump -i eth0 dst 50.116.66.139 # tcpdump -i eth0 src 50.116.66.139

Wireshark Wireshark is a open source and freely available network analyzer tool which is shipped with most of the Linux distributions now a days.