Networking in Gnu/Linux

download Networking in Gnu/Linux

If you can't read please download the document

Transcript of Networking in Gnu/Linux

Networking for GNU/Linux

Ahmed D. Mekkawy AKA [email protected]

Part I : TCP/IP overview

Though you should already know TCP/IP, this quick overview Is made to make sure that all course attendees are aligned.

OSI Model Vs. TCP/IP Model

TCP/IP Connection Types

TCP: Connection OrientedInitiating a connection: 3 Way Handshaking

Finalizing a connection.

UDP: Connectionless

ICMP: Error, Control, Information.

Ports

Lower numbered Vs. Higher numbered ports.

Ports can handle multi-connection.

Listening Ports.

TTL

Time To Live.

Decreased by 1 with each router passed.

Designed to forbid packets to flow endlessly because of a mis-configured router or so.

IP

IPv4 Vs. IPv6

Private IPs (eg. 192.168.xxx.xxx , 10.xxx.xxx.xxx)

Localhost (127.xxx.xxx.xxx)

Subnets & netmask.

Network & Broadcast IP.

Gateways

Routing.

Natting.

Port-Forwarding.

Firewalling.

Hub Vs. Switch

Switch Vs. Hub

Switch Vs. Router

Access Points, are they Switches or Hubs?

Main Network Services

DNS

DHCP

Part II: Configure wired NIC

The Native way

ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up

Ifup & ifdown

Multiple Ips on the same NIC: Child interfaces:Ifconfig eth0:0 10.0.0.2 netmask 255.255.255.0 up

Routing:route add default gw 192.168.0.1 eth0

route add -net 10.0.0.1 netmask 255.0.0.0 gw 192.168.0.200 eth0

DHCP client: dhclient eth0

The native way - Contd.

hostname

/etc/resolv.conf

/etc/hosts

The Redhat/Fedora way

/etc/sysconfig/network-scripts/ifcfg-eth0

Or

# File: ifcfg-eth0DEVICE=eth0IPADDR=192.168.1.100NETMASK=255.255.255.0BOOTPROTO=staticONBOOT=yes# The following settings are optionalBROADCAST=192.168.1.255NETWORK=192.168.1.0

# File: ifcfg-eth0DEVICE=eth0BOOTPROTO=dhcpONBOOT=yes

Redhat way - Contd.

/etc/sysconfig/network

Static routes can be added per NIC:

NETWORKING=yesHOSTNAME=bigboyGATEWAY=192.168.1.1

# File /etc/sysconfig/network-scripts/route-wlan0#10.0.0.0/8 via 192.168.1.254

Debian / Ubuntu way

/etc/network/interfaces

# File: /etc/network/interfaces# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth1iface 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

Debian / Ubuntu way - Contd.

/etc/network/interfaces Contd

/etc/hostname

auto eth1:1iface eth1:1 inet static address 216.10.119.239 netmask 255.255.255.224

# The secondary network interfaceauto eth0iface eth0 inet dhcp

Part III: Configuring wireless

Wireless Network

ls /sys/classes/net

ls /sys/classes/net/eth1 (look for wireless)

iwlist eth1 scan

Ifconfig eth1 0.0.0.0 up

iwconfig eth1 mode Managed

iwconfig eth1 channel 6

Iwconfig eth1 key restricted s:MyKey # for WEP

Wireless Network - Contd.

If the encryption is WAP:Ifconfig eth1 0.0.0.0 up

Killall wpa_supplicant

wpa_passphrase linksys mysecret > /etc/wpa_supplicant.conf

Iwconfig eth1 mode Managed

Iwconfig eth1 essid linksys

Iwconfig eth1 channel 11

wpa_supplicant -i eth1 -c /etc/wpa_supplicant.conf -d -D wext &

Wireless Network - Contd.

Then get the IP normally through dhcp or through ifconfig command.

dhclient eth1

Reference

http://www.linuxhomenetworking.com

linuxac.org Magazine Jan, 2008

Click to edit the title text

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level