Introduction to Linux Networking Kevin Moule [email_address] August 15 th , 2006
Knoppix  <ul><li>Knoppix is a live Linux system that is bootable from CD or DVD </li></ul><ul><ul><li>Fully featured Linux...
Opening a root shell <ul><li>Click on the konsole icon </li></ul>
Opening a root shell <ul><li>Type “su” at the prompt </li></ul>
Enumerating network devices <ul><li>Use the ifconfig command to list the network devices </li></ul>root@3[~]#  ifconfig -a...
lo - Loopback device <ul><li>The loopback device is present on virtually any IP based machine </li></ul><ul><ul><li>Any da...
Enumerating network devices <ul><li>Use the ifconfig command to list the network devices </li></ul>root@3[~]#  ifconfig -a...
ethX – Ethernet device <ul><li>The ethernet devices are physical network cards operating on the ethernet standard </li></u...
Other devices <ul><li>There are many other possible devices </li></ul><ul><ul><li>pppX – Point to Point devices used in di...
Configuring network devices <ul><li>The file  /etc/network/interfaces  stores the configuration information for all networ...
Configuring network devices <ul><li>Enter the following for a static configuration of eth0 </li></ul>auto eth0 iface eth0 ...
Configuring network devices <ul><li>The address line specifies which IP address will be assigned to this machine </li></ul...
Configuring network devices <ul><li>The broadcast line specifies which address will be used for special broadcast packets ...
Configuring network devices <ul><li>The netmask line specifies what addresses are consider on the local network </li></ul>...
Configuring network devices <ul><li>The gateway line specifies what address is used to forward non local packets </li></ul...
Configuring network devices <ul><li>Enter the following for a dynamic (DHCP) configuration of eth0 </li></ul><ul><ul><li>W...
Configuring network devices <ul><li>Once the configuration is finished use the ifup and ifdown commands to control the net...
Testing the network <ul><li>The ping command is a useful tool for testing a network configuration </li></ul><ul><ul><li>Us...
Testing the network <ul><li>First attempt to ping the gateway </li></ul>root@4[~]#  ping 192.168.1.1 PING 192.168.1.1 (192...
Testing the network <ul><li>Ping a non-existent machine </li></ul>root@4[~]#  ping 192.168.1.55 PING 192.168.1.55 (192.168...
Testing the network <ul><li>Ping a known local address </li></ul>root@4[~]#  ping 192.168.1.100 PING 192.168.1.100 (192.16...
Testing the network <ul><li>Ping a non-local address </li></ul>root@4[~]#  ping 129.97.114.212 PING 129.97.114.212 (129.97...
Configuring DNS <ul><li>DNS (Domain Name System) is the system for resolving host names into IP addresses </li></ul><ul><u...
Configuring DNS <ul><li>The local DNS information is stored in  /etc/resolv.conf </li></ul><ul><ul><li>All applications re...
Configuring DNS <ul><li>Ping a named machine </li></ul>root@4[~]#  ping ns1.uwaterloo.ca PING ns1.uwaterloo.ca (129.97.128...
Client/Server communication <ul><li>Communication on an IP network follows the client/server model </li></ul><ul><ul><li>A...
Client/Server communication <ul><li>A socket is comprised of the following </li></ul><ul><ul><li>Server IP address </li></...
Client/Server communication <ul><li>There are many network connections (sockets) being used simultaneously </li></ul><ul><...
Client/Server communication <ul><li>Using the netcat utility start a server listening on a specific port </li></ul>root@4[...
Client/Server communication <ul><li>Using the netcat utility start a client connection to the server with the server IP ad...
Client/Server communication <ul><li>Any text typed in the client window will show up in the server window and vice versa <...
Upcoming SlideShare
Loading in …5
×

Introduction to Linux Networking.ppt

4,880 views

Published on

  • Be the first to comment

  • Be the first to like this

Introduction to Linux Networking.ppt

  1. 1. Introduction to Linux Networking Kevin Moule [email_address] August 15 th , 2006
  2. 2. Knoppix <ul><li>Knoppix is a live Linux system that is bootable from CD or DVD </li></ul><ul><ul><li>Fully featured Linux system </li></ul></ul><ul><ul><li>Automatic hardware detection </li></ul></ul><ul><ul><li>Runs completely from CD and RAM </li></ul></ul>
  3. 3. Opening a root shell <ul><li>Click on the konsole icon </li></ul>
  4. 4. Opening a root shell <ul><li>Type “su” at the prompt </li></ul>
  5. 5. Enumerating network devices <ul><li>Use the ifconfig command to list the network devices </li></ul>root@3[~]# ifconfig -a lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:18 errors:0 dropped:0 overruns:0 frame:0 TX packets:18 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1092 (1.0 KiB) TX bytes:1092 (1.0 KiB)
  6. 6. lo - Loopback device <ul><li>The loopback device is present on virtually any IP based machine </li></ul><ul><ul><li>Any data sent to the loopback device is immediately returned </li></ul></ul><ul><ul><li>Used mainly for testing, but has some use in specific network applications </li></ul></ul><ul><ul><li>Strictly internal device, always assigned the 127.0.0.1 address </li></ul></ul>
  7. 7. Enumerating network devices <ul><li>Use the ifconfig command to list the network devices </li></ul>root@3[~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:02:B3:8C:4C:ED inet addr:192.168.1.254 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::202:b3ff:fe8c:4ced/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:741 errors:0 dropped:0 overruns:0 frame:0 TX packets:895 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:82106 (80.1 KiB) TX bytes:548518 (535.6 KiB)
  8. 8. ethX – Ethernet device <ul><li>The ethernet devices are physical network cards operating on the ethernet standard </li></ul><ul><ul><li>Most common network device </li></ul></ul><ul><ul><li>Multiple devices supported (eth0, eth1, etc.) </li></ul></ul><ul><ul><li>Each card has a globally unique hardware address assigned to it, the MAC (Media Access Control) address </li></ul></ul>
  9. 9. Other devices <ul><li>There are many other possible devices </li></ul><ul><ul><li>pppX – Point to Point devices used in dialup internet services or VPN settings </li></ul></ul><ul><ul><li>wlanX – Wireless devices, similar to ethernet but using a different communication standard </li></ul></ul>
  10. 10. Configuring network devices <ul><li>The file /etc/network/interfaces stores the configuration information for all network devices </li></ul>root@3[~]# cat /etc/network/interfaces # /etc/network/interfaces -- configuration file for ifup(8),ifdown(8) # The loopback interface # automatically added when upgrading auto lo iface lo inet loopback
  11. 11. Configuring network devices <ul><li>Enter the following for a static configuration of eth0 </li></ul>auto eth0 iface eth0 inet static address 192.168.1.XXX netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 root@3[~]# nedit /etc/network/interfaces
  12. 12. Configuring network devices <ul><li>The address line specifies which IP address will be assigned to this machine </li></ul><ul><ul><li>Must be unique within the local network </li></ul></ul>auto eth0 iface eth0 inet static address 192.168.1.XXX netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
  13. 13. Configuring network devices <ul><li>The broadcast line specifies which address will be used for special broadcast packets </li></ul><ul><ul><li>All machine on the local network should be using the same broadcast address </li></ul></ul><ul><ul><li>This address should not otherwise be in use </li></ul></ul>auto eth0 iface eth0 inet static address 192.168.1.XXX netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
  14. 14. Configuring network devices <ul><li>The netmask line specifies what addresses are consider on the local network </li></ul><ul><ul><li>The address line and the netmask line combine to form the LAN (local area network) </li></ul></ul>auto eth0 iface eth0 inet static address 192.168.1.XXX netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
  15. 15. Configuring network devices <ul><li>The gateway line specifies what address is used to forward non local packets </li></ul><ul><ul><li>This address should be a router capable of routing traffic to the internet at large </li></ul></ul>auto eth0 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1
  16. 16. Configuring network devices <ul><li>Enter the following for a dynamic (DHCP) configuration of eth0 </li></ul><ul><ul><li>Will attempt to query a local DHCP server to provide the network configuration </li></ul></ul>root@3[~]# nedit /etc/network/interfaces auto eth0 iface eth0 inet dhcp
  17. 17. Configuring network devices <ul><li>Once the configuration is finished use the ifup and ifdown commands to control the network device </li></ul><ul><li>Bring an interface down with ifdown </li></ul><ul><li>Bring an interface up with ifup </li></ul>root@3[~]# ifdown eth0 root@3[~]# ifup eth0
  18. 18. Testing the network <ul><li>The ping command is a useful tool for testing a network configuration </li></ul><ul><ul><li>Uses an special ICMP (Internet Control Message Protocol) packet to ‘ping’ a given address </li></ul></ul><ul><ul><li>A machine that receives a ‘ping’ packet will send a similar ‘ping’ packet back </li></ul></ul><ul><ul><li>Universally available, requires no running services </li></ul></ul>
  19. 19. Testing the network <ul><li>First attempt to ping the gateway </li></ul>root@4[~]# 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=128 time=0.129 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=128 time=0.148 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=128 time=0.148 ms 64 bytes from 192.168.1.1: icmp_seq=4 ttl=128 time=0.150 ms 64 bytes from 192.168.1.1: icmp_seq=5 ttl=128 time=0.154 ms --- 192.168.1.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3996ms rtt min/avg/max/mdev = 0.129/0.145/0.154/0.017 ms root@4[~]#
  20. 20. Testing the network <ul><li>Ping a non-existent machine </li></ul>root@4[~]# ping 192.168.1.55 PING 192.168.1.55 (192.168.1.55) 56(84) bytes of data. From 192.168.1.50 icmp_seq=1 Destination Host Unreachable From 192.168.1.50 icmp_seq=2 Destination Host Unreachable From 192.168.1.50 icmp_seq=3 Destination Host Unreachable From 192.168.1.50 icmp_seq=4 Destination Host Unreachable From 192.168.1.50 icmp_seq=5 Destination Host Unreachable --- 192.168.1.55 ping statistics --- 7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6015ms, pipe 3 root@4[~]#
  21. 21. Testing the network <ul><li>Ping a known local address </li></ul>root@4[~]# ping 192.168.1.100 PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data. 64 bytes from 192.168.1.100: icmp_seq=1 ttl=64 time=0.036 ms 64 bytes from 192.168.1.100: icmp_seq=2 ttl=64 time=0.036 ms 64 bytes from 192.168.1.100: icmp_seq=3 ttl=64 time=0.035 ms 64 bytes from 192.168.1.100: icmp_seq=4 ttl=64 time=0.039 ms 64 bytes from 192.168.1.100: icmp_seq=5 ttl=64 time=0.038 ms --- 192.168.1.100 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.035/0.036/0.039/0.007 ms root@4[~]#
  22. 22. Testing the network <ul><li>Ping a non-local address </li></ul>root@4[~]# ping 129.97.114.212 PING 129.97.114.212 (129.97.114.212) 56(84) bytes of data. 64 bytes from 129.97.114.212: icmp_seq=1 ttl=253 time=2.09 ms 64 bytes from 129.97.114.212: icmp_seq=2 ttl=253 time=1.96 ms 64 bytes from 129.97.114.212: icmp_seq=3 ttl=253 time=2.73 ms 64 bytes from 129.97.114.212: icmp_seq=4 ttl=253 time=2.00 ms 64 bytes from 129.97.114.212: icmp_seq=5 ttl=253 time=2.04 ms --- 129.97.114.212 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4004ms rtt min/avg/max/mdev = 1.964/2.168/2.734/0.287 ms root@4[~]#
  23. 23. Configuring DNS <ul><li>DNS (Domain Name System) is the system for resolving host names into IP addresses </li></ul><ul><ul><li>Globally administered (by ICANN) </li></ul></ul><ul><ul><li>Locally distributed (per domain) </li></ul></ul><ul><li>UW runs a DNS </li></ul><ul><ul><li>Services queries for any xxx.uwaterloo.ca </li></ul></ul><ul><ul><li>Redirects other queries (i.e. www.google.ca ) for the entire university </li></ul></ul>
  24. 24. Configuring DNS <ul><li>The local DNS information is stored in /etc/resolv.conf </li></ul><ul><ul><li>All applications reference this file to resolve hostnames into IP address </li></ul></ul>root@3[~]# nedit /etc/resolv.conf nameserver 129.97.128.10 nameserver 129.97.128.100
  25. 25. Configuring DNS <ul><li>Ping a named machine </li></ul>root@4[~]# ping ns1.uwaterloo.ca PING ns1.uwaterloo.ca (129.97.128.10) 56(84) bytes of data. 64 bytes from ns1.uwaterloo.ca (129.97.128.10): icmp_seq=1 ttl=253 time=81.2 ms 64 bytes from ns1.uwaterloo.ca (129.97.128.10): icmp_seq=2 ttl=253 time=2.28 ms 64 bytes from ns1.uwaterloo.ca (129.97.128.10): icmp_seq=3 ttl=253 time=2.34 ms 64 bytes from ns1.uwaterloo.ca (129.97.128.10): icmp_seq=4 ttl=253 time=2.29 ms 64 bytes from ns1.uwaterloo.ca (129.97.128.10): icmp_seq=5 ttl=253 time=1.25 ms --- ns1.uwaterloo.ca ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4003ms rtt min/avg/max/mdev = 1.252/17.886/81.258/31.688 ms root@4[~]#
  26. 26. Client/Server communication <ul><li>Communication on an IP network follows the client/server model </li></ul><ul><ul><li>A server is actively listening for connection from a client </li></ul></ul><ul><ul><li>A client will explicitly start a connection to the server </li></ul></ul><ul><ul><li>Once established, this connection is referred to as a socket </li></ul></ul>
  27. 27. Client/Server communication <ul><li>A socket is comprised of the following </li></ul><ul><ul><li>Server IP address </li></ul></ul><ul><ul><li>Server port </li></ul></ul><ul><ul><li>Client IP address </li></ul></ul><ul><ul><li>Client port </li></ul></ul><ul><li>However, once established the notion of server and client are often irrelevant </li></ul>
  28. 28. Client/Server communication <ul><li>There are many network connections (sockets) being used simultaneously </li></ul><ul><li>Ports are used to associate communication with a particular application </li></ul><ul><ul><li>A 16 bit integer (0-65535) </li></ul></ul><ul><ul><li>Dynamically allocated for client purposes </li></ul></ul><ul><ul><li>Fixed numbers for many server applications </li></ul></ul><ul><ul><ul><li>Web (80), FTP (20), Email (25), DNS (53), etc. </li></ul></ul></ul>
  29. 29. Client/Server communication <ul><li>Using the netcat utility start a server listening on a specific port </li></ul>root@4[~]# netcat -l -p YYY
  30. 30. Client/Server communication <ul><li>Using the netcat utility start a client connection to the server with the server IP address and port </li></ul>root@4[~]# netcat 192.168.1.XXX YYY
  31. 31. Client/Server communication <ul><li>Any text typed in the client window will show up in the server window and vice versa </li></ul>root@4[~]# netcat -l -p YYY Hello Goodbye root@4[~]# netcat 192.168.1.XXX YYY Hello Goodbye

×