Presentation is loading. Please wait.

Presentation is loading. Please wait.

Links and LANs 2004-04-06. Link between two computers via cross cable The most simple way to connect two hosts is to link the two hosts with a cross cable.

Similar presentations


Presentation on theme: "Links and LANs 2004-04-06. Link between two computers via cross cable The most simple way to connect two hosts is to link the two hosts with a cross cable."— Presentation transcript:

1 Links and LANs 2004-04-06

2 Link between two computers via cross cable The most simple way to connect two hosts is to link the two hosts with a cross cable. The most simple way to connect two hosts is to link the two hosts with a cross cable. Work in group of 4 people. Work in group of 4 people.

3 Configure IP adresses Configure the IP adresses according to values in the picture. Configure the IP adresses according to values in the picture. -Ifconfig [interface] [IP-adress] / [netmask] Use the ping command to verify your set up, try to ping from one host to another. Use the ping command to verify your set up, try to ping from one host to another.

4 Link between two computers via a hub Another way to connect two computers is to use a hub. A hub is a simple network device providing a common point of connection to all other devices in the network Another way to connect two computers is to use a hub. A hub is a simple network device providing a common point of connection to all other devices in the network Use a straight cable to connect a computer to the hub. Use a straight cable to connect a computer to the hub.

5

6 Configure the IP adresses according to the picture Configure the IP adresses according to the picture Ping from one host to another. Does it work? Ping from one host to another. Does it work? Start ethereal or tcpdump on one of the hosts and capture traffic on the Ethernet interface. What do you see from ethereal? Start ethereal or tcpdump on one of the hosts and capture traffic on the Ethernet interface. What do you see from ethereal?

7 Connect two hubs together Group A and B should work together and connect their hubs together. Group A and B should work together and connect their hubs together.

8 Try to ping from one host in group A to one host in group B. Does it work? Explain what you see. Try to ping from one host in group A to one host in group B. Does it work? Explain what you see. Try to configure IP address of H3 and H4 to 10.0.0.3/24 and 10.0.0.4/24 respectively. Try to configure IP address of H3 and H4 to 10.0.0.3/24 and 10.0.0.4/24 respectively. Try to ping from one host in A to one host in B. Does it work? Explain what you see. Try to ping from one host in A to one host in B. Does it work? Explain what you see.

9 DHCP (Dynamic Host Configuration Protocol)

10 DHCP In stateful address assignment there is a server that keeps track of what addresses that are currently in use and which addresses that could be assigned to new hosts. In stateful address assignment there is a server that keeps track of what addresses that are currently in use and which addresses that could be assigned to new hosts. DHCP is an example of a stateful address assignment DHCP is an example of a stateful address assignment

11 Getting started – server and client Work in group of 2, where one is the DHCP server and one is the client. Work in group of 2, where one is the DHCP server and one is the client.

12 Start with configuring the server: Start with configuring the server: -Your DHCP server should hand out addresses in the range 10.0.0.10-10.0.0.20 (netmask 255.255.255.0). - Although we neither have a router nor any DNS server in this setup, make sure that any DHCP client will get default router 10.0.0.1 and name server 10.0.0.5. -Let th domain name be dhcp.lab. Set the default lease time to 2 minutes (very short).

13 Dhcp.conf file Create the dhcp.conf file Create the dhcp.conf file - vi /etc/dhcpd.conf Should look like this: # This is a very basic subnet declaration. subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.10 10.0.0.20; option routers 10.0.0.1; option domain-name-servers 10.0.0.5; option domain-name "dhcp.lab"; default-lease-time 120; max-lease-time 120; }

14 Start the DHCP server /usr/sbin/dhcpd /usr/sbin/dhcpd You may first have to do: touch /var/lib/dhcp/dhcpd.leases touch /var/lib/dhcp/dhcpd.leases To make sure that the DHCP server started without any errors check the /var/log/messages file with: tail /var/log/messages tail /var/log/messages

15 Start the DHCP client dhclient [interface] (the interface that the clients use to connect to the LAN) dhclient [interface] (the interface that the clients use to connect to the LAN) What IP address were assigned to the clients? What IP address were assigned to the clients?

16 To verify that default gateway and name-server were configured correctly inspect the routing table with: To verify that default gateway and name-server were configured correctly inspect the routing table with: route –n and view the resolver file: cat /etc/resolv.conf If you are not getting an IP address via dhclient even you have configured everything correctly, run: If you are not getting an IP address via dhclient even you have configured everything correctly, run: iptables –F killall dhclient This command flushes the firewall rules. This command flushes the firewall rules. Use ethereal or tcpdump to check the traffic Use ethereal or tcpdump to check the traffic

17 Duplicate address detection in DHCP Duplicate Address Detection (DAD) is useful in stateful address assignment schemes such as DHCP, even though the DHCP server keeps track of the addresses that are supposed to be free. The reason is that some other machine could have been configured with one of these addresses (perhaps manually) without asking the DHCP server for permission! Duplicate Address Detection (DAD) is useful in stateful address assignment schemes such as DHCP, even though the DHCP server keeps track of the addresses that are supposed to be free. The reason is that some other machine could have been configured with one of these addresses (perhaps manually) without asking the DHCP server for permission! Two groups should now work together to establish the setup. One machine can monitor the network traffic with Ethereal, and one machine will be the bad guy (B). You will need a hub to connect all machines on the same LAN. Two groups should now work together to establish the setup. One machine can monitor the network traffic with Ethereal, and one machine will be the bad guy (B). You will need a hub to connect all machines on the same LAN.

18

19 Before you attach the bad guy machine (B) to the network, stop dhclient on the client (C) as usual with For client #killall dhclient Configure (manually) the IP address of machine (B) to be the address that the client (C) earlier leased ifconfig eth0 ifconfig eth0 route –n In the DHCP server (S), delete any remaining entry of ipAddressOfC in the ARP cache with arp -d arp -d Then run dhcpcd eth0 on the client (C) again, and observe the messages exchanged on the LAN. Also observe the /var/log/messages file on the DHCP server with tail /var/log/messages Will (C) get the same address again, or will it be assigned some other address? Will (C) get the same address again, or will it be assigned some other address?

20 Using DHCP relay agents Having a DHCP server present on every sub network may be result in lots of machines and servers for the system administrators to maintain. Having a DHCP server present on every sub network may be result in lots of machines and servers for the system administrators to maintain. In order to serve DHCP clients although no DHCP server is present, one could make the routers (or even some other machine on the link) act as DHCP relay. Then you can centralize the DHCP server and simplify management. In order to serve DHCP clients although no DHCP server is present, one could make the routers (or even some other machine on the link) act as DHCP relay. Then you can centralize the DHCP server and simplify management.

21

22 1. Configure the two routers (R1 and R2) with appropriate IP addresses for both of their Ethernet interfaces (use ifconfig as usual). 2. Enable routing on both R1 an R2 by writing the following command in a shell. sysctl -w net.ipv4.ip forward=1 # vi /etc/sysctl.conf (If you want routing to be enabled at startup you could edit the file /etc/sysctl.conf.) 3. Add routes to the networks behind the other router, i.e., on R1 do route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.0.4 and on R2 do route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.0.0.3

23 4. On the DHCP server, add routes to both networks in the same way earlier. 5. Verify your setup by letting the DHCP server ping both 10.0.1.1 and 10.0.2.1, let R1ping 10.0.2.1 and let R2 ping 10.0.1.1. 6. Now, if routing seems to work alright, it is time to configure the DHCP server and DHCP relay agents. - Update the dhcpd.conf file to assign address on the 10.0.1.0/24 and 10.0.2.0/24 networks as well. - Update the dhcpd.conf file to assign address on the 10.0.1.0/24 and 10.0.2.0/24 networks as well.

24 Example of addition to /etc/dhcpd.conf file subnet 10.0.1.0 netmask 255.255.255.0 { range 10.0.1.30 10.0.2.40; option routers 10.0.1.1; option domain-name-servers 10.0.1.5; option domain-name "dhcp.1.lab"; default-lease-time 180; max-lease-time 180; } subnet 10.0.2.0 netmask 255.255.255.0 { range 10.0.2.50 10.0.2.60; option routers 10.0.2.1; option domain-name-servers 10.0.2.5; option domain-name "dhcp.2.lab"; default-lease-time 240; max-lease-time 240; }

25 Make sure that the host on each of the subnet are assigned a default router appropriate for that network, with Make sure that the host on each of the subnet are assigned a default router appropriate for that network, with route add default gw [ip address of default router] Start the DHCP relay agent on both R1 and R2 dhcrelay [ip address of DHCP server] 7. Hopefully everything should work now. Please attach a host to each of the two network with DHCP relay support. Did they get appropriate addresses? Are they able to ping each other? Inspect the routing table again with route –n and then view the resolver file cat /etc/resolv.conf to verify that default gateway and name-server were configured correctly for the hosts.


Download ppt "Links and LANs 2004-04-06. Link between two computers via cross cable The most simple way to connect two hosts is to link the two hosts with a cross cable."

Similar presentations


Ads by Google