Networking in Gnu/Linux

3,456 views

Published on

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
3,456
On SlideShare
0
From Embeds
0
Number of Embeds
37
Actions
Shares
0
Downloads
121
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Networking in Gnu/Linux

  1. 1. Networking for GNU/Linux <ul>Ahmed D. Mekkawy AKA linuxawy [email_address] </ul>
  2. 2. Part I : TCP/IP overview <ul><li>Though you should already know TCP/IP, this quick overview Is made to make sure that all course attendees are aligned. </li></ul>
  3. 3. OSI Model Vs. TCP/IP Model
  4. 4. TCP/IP Connection Types <ul><li>TCP: Connection Oriented </li><ul><li>Initiating a connection: 3 Way Handshaking
  5. 5. Finalizing a connection. </li></ul><li>UDP: Connectionless
  6. 6. ICMP: Error, Control, Information. </li></ul>
  7. 7. Ports <ul><li>Lower numbered Vs. Higher numbered ports.
  8. 8. Ports can handle multi-connection.
  9. 9. Listening Ports. </li></ul>
  10. 10. TTL <ul><li>Time To Live.
  11. 11. Decreased by 1 with each router passed.
  12. 12. Designed to forbid packets to flow endlessly because of a mis-configured router or so. </li></ul>
  13. 13. IP <ul><li>IPv4 Vs. IPv6
  14. 14. Private IPs (eg. 192.168.xxx.xxx , 10.xxx.xxx.xxx)
  15. 15. Localhost (127.xxx.xxx.xxx)
  16. 16. Subnets & netmask.
  17. 17. Network & Broadcast IP. </li></ul>
  18. 18. Gateways <ul><li>Routing.
  19. 19. Natting.
  20. 20. Port-Forwarding.
  21. 21. Firewalling. </li></ul>
  22. 22. Hub Vs. Switch <ul><li>Switch Vs. Hub
  23. 23. Switch Vs. Router
  24. 24. Access Points, are they Switches or Hubs? </li></ul>
  25. 25. Main Network Services <ul><li>DNS
  26. 26. DHCP </li></ul>
  27. 27. Part II: Configure wired NIC
  28. 28. The Native way <ul><li>ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up
  29. 29. Ifup & ifdown
  30. 30. Multiple Ips on the same NIC: Child interfaces: </li><ul><li>Ifconfig eth0:0 10.0.0.2 netmask 255.255.255.0 up </li></ul><li>Routing: </li><ul><li>route add default gw 192.168.0.1 eth0
  31. 31. route add -net 10.0.0.1 netmask 255.0.0.0 gw 192.168.0.200 eth0 </li></ul><li>DHCP client: dhclient eth0 </li></ul>
  32. 32. The native way - Contd. <ul><li>hostname
  33. 33. /etc/resolv.conf
  34. 34. /etc/hosts </li></ul>
  35. 35. The Redhat/Fedora way <ul><li>/etc/sysconfig/network-scripts/ifcfg-eth0
  36. 36. Or </li></ul># File: ifcfg-eth0 DEVICE=eth0 IPADDR=192.168.1.100 NETMASK=255.255.255.0 BOOTPROTO=static ONBOOT=yes # The following settings are optional BROADCAST=192.168.1.255 NETWORK=192.168.1.0 # File: ifcfg-eth0 DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes
  37. 37. Redhat way - Contd. <ul><li>/etc/sysconfig/network
  38. 38. Static routes can be added per NIC: </li></ul>NETWORKING=yes HOSTNAME=bigboy GATEWAY=192.168.1.1 # File /etc/sysconfig/network-scripts/route-wlan0 # 10.0.0.0/8 via 192.168.1.254
  39. 39. Debian / Ubuntu way <ul><li>/etc/network/interfaces </li></ul># File: /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth1 iface eth1 inet static address 216.10.119.240 netmask 255.255.255.224 network 216.10.119.224 broadcast 216.10.119.255 gateway 216.10.119.241 # dns-* options are implemented by the resolvconf dns-nameservers 216.10.119.241 up route add -net 10.0.0.0 netmask 255.0.0.0 gw 216.10.119.225 eth1
  40. 40. Debian / Ubuntu way - Contd. <ul><li>/etc/network/interfaces Contd
  41. 41. /etc/hostname </li></ul>auto eth1:1 iface eth1:1 inet static address 216.10.119.239 netmask 255.255.255.224 # The secondary network interface auto eth0 iface eth0 inet dhcp
  42. 42. Part III: Configuring wireless
  43. 43. Wireless Network <ul><li>ls /sys/classes/net
  44. 44. ls /sys/classes/net/eth1 (look for “wireless”)
  45. 45. iwlist eth1 scan
  46. 46. Ifconfig eth1 0.0.0.0 up
  47. 47. iwconfig eth1 mode Managed
  48. 48. iwconfig eth1 channel 6
  49. 49. Iwconfig eth1 key restricted s:MyKey # for WEP </li></ul>
  50. 50. Wireless Network - Contd. <ul><li>If the encryption is WAP: </li><ul><li>Ifconfig eth1 0.0.0.0 up
  51. 51. Killall wpa_supplicant
  52. 52. wpa_passphrase linksys mysecret > /etc/wpa_supplicant.conf
  53. 53. Iwconfig eth1 mode Managed
  54. 54. Iwconfig eth1 essid linksys
  55. 55. Iwconfig eth1 channel 11
  56. 56. wpa_supplicant -i eth1 -c /etc/wpa_supplicant.conf -d -D wext & </li></ul></ul>
  57. 57. Wireless Network - Contd. <ul><li>Then get the IP normally through dhcp or through ifconfig command.
  58. 58. dhclient eth1 </li></ul>
  59. 59. Reference <ul><li>http://www.linuxhomenetworking.com
  60. 60. linuxac.org Magazine Jan, 2008 </li></ul>

×