How to connect 2 Router on same network

how to connect a network switch to a router and how to connect network switch with network router
HartJohnson Profile Pic
HartJohnson,United States,Professional
Published Date:02-08-2017
Your Website URL(Optional)
Comment
6 connecting networks with routers Bringing Things Together I thought we had such a great connection... Need to a get a network connection to a place far, far away? So far, we’ve shown you the ins and outs of how you get a single network up and running. But what do you do if you need to share resources with some other network? That’s where routers come into their own. Routers specialize in seamlessly moving network traffic from one network to another, and in this chapter you’ll learn exactly how they do that. We’ll show you how to program your router, and how the router itself can help you troubleshoot any problems. Keep reading, and you’ll find it’s out of this world... this is a new chapter 205 Download at ato the moon Walking on the moon Houston, this is Moonbase. The Network Pro has landed. The Moonbase is a NASA command center that’s been set up on the moon, and they need to establish a video connection with the International Space Station (ISS). There’s just one problem— there’s no network on the Moonbase to allow them to communicate with it. Think you can help them out? 206 Chapter 7 Download at a NetworkingNetwork switch connecting networks with routers . Start your moon network by connecting up the devices below into a network that will allow communications on the Internet using the radio. you are here 4 207 Download at a Radio to ISS RouterThere are only 2 connections on the router, one for our network, and one for the ISS network connected throug the radio. Network switch connect these devices Start your moon network by connecting up the devices below into a network that will allow communications on the Internet using the radio. 208 Chapter 6 Download at a All of the Moon network devices are connected to the switch. Radio to ISS RouterA router sits in-between two networks and converts the network addresses. connecting networks with routers We need to connect two networks The physical together network is the So how do you generally connect two networks together? The hardware such as first thing you need is a working local area network (LAN). Second, you need a connection to that other network. This the cables, switches, could be a Cat 5 cable or fiber or even a radio link. Finally, you need a router to connect the 2 networks. The router hubs, and routers. connects the networks physically as well as logically. The logical network is Network 1 the network addressing stuff. Network 2 Network switch The Moonbase and ISS networks are now connected with a router. So is everything working? you are here4 209 Download at a he network “cloud” contains a T ll the stuff on that network. Here is what could be in the network cloud. Physical connectionlights aren’t everything The light’s on, but nobody’s home The LEDs on the Moonbase switch are flashing, but unfortunately, there’s still no video connection with the ISS. What do you think the flashing LEDs have to do with traffic on the network? Remember from the previous chapter, that data sent on an Ethernet network travel as discrete units called frames. The LEDs flashing let you know that a particular port is sending or receiving network traffic in the form of these frames. The frames are directed where to go based on the MAC address inside the frame. So, the LEDs represent network traffic. But does that mean your network is working? Remember, every How would you find out? network device on an Ethernet network has to have a MAC address if it is How would you go about monitoring conversations going to send and on the network? What would you use? receive network traffic. 210 Chapter 6 Download at a The lights on the switch are flashing, but we’re not getting through to the ISS. So what’s up?connecting networks with routers Q: Q: Q: So why do we have to use a So do I always need to connect a So the difference betweeen my router? Can’t the switch connect to the computer to a switch? home DSL router and an enterprise radio? switching router is the software? A: To a switch or to a hub, but never A: We have to use a router when we directly to a router. A: The big difference is the hardware connect two networks. The router acts as horsepower. Your home DSL router a “translator” between the two networks. probably uses a small embedded processor Q: But I have a DSL router at home, Simple switches do not have the brains for or microcontroller which does all the and my computer is directly connected this. processing. Switching routers and heavy to it. What is that all about? duty routers have specialized processors with individual processors on each port. Q: What is the router “translating”? A: Good observation. There are The name of the game is the speed at switches that have routing capability and which is can move packets. Your home DSL A: In simply terms: network addresses. routers that have switched ports. There router probably has a throughput of about The two different networks are like 2 is not a real clear line between the two 20 Mbps (Megabits per second), whereas different cities. The router moves the data devices. It is more about their primary a high end switching router can have a from one network to another. function. Now, in large networks, there are throughput of hundreds of Gbps (Gigabits switching routers. These have software per second) or more. that allow them to work as routers on switched ports. They are great to use and make building large sophisticated networks straightforward, but they are very expensive. you are here4 211 Download at aClick this to capture some traffic. MAC address of device at 70.38.72.209 what traffic is on our network? Let’s see what traffic is on our network A packet sniffer program like Wireshark can show you the network traffic between devices. Wireshark can help you find out when devices are trying to communicate but can’t for some reason. What would you see if a device was trying but failing to have a network conversation? 212 Chapter 6 Download at a The device at 70.38.72.209 is sending a frame to a device at 192.1681.1.47. Only network nodes with the same IP network address can communicate across a switch. A switch can only deal with MAC addresses. A router is needed to connect two different IP networks. connecting networks with routers Here’s captured network traffic from the switch. There’s lots of traffic here, but it’s not making any sense. Frank: What are all these different from and to addresses in this packets? Jim: Those are IP addresses. Frank: What are those used for? Jim: Well, this is a TCP/IP network, and those are the network addresses of the various devices on the network. Frank: Why are they all different? Jim: They have to be unique on the network, like a telephone number is unique. Frank: I get that, but some of these numbers are really different. Jim: Oh yeah I didn’t notice that. It seems there are a couple of conversations going on, but none of the machines using the one type of address are talking with the other machines. Frank: I bet they are on a different TCP/IP network Jim: So how can we get them to talk with each other? you are here 4 213 Download at aAssigned to the manufacturer by IEEE The /24 tells us that the first 24 bit, or 3 bytes, are the network address and is called the subnet mask. Determined by manufacturer mac address or ip address? MAC address versus IP address So why can’t a MAC address be used to move traffic from one network to another? It’s all in the numbers... 192.168.100.1 A IP address is made up of a network address and a host address. The host part is the unique bit assigned to a particular network device. It is 00:A3:03:51:0E:AC much like a phone number. which has a country code, area code, and local calling area—finally, A MAC address is assigned to every device your unique individual number. connected to an Ethernet network. In your computer, that is the network card. The beginning part of the MAC address designates The ability to create groups of IP address, the manufacturer. The later part, the called IP networks is built into the number itself. manufacturer increments, so all their products have unique MAC addresses. It is like a social security number, in that you really can’t tell where a person lives just by looking at it. There is no way to store network information in the MAC address. Each address is specific and 192.168.100.0/24 unique to the piece of hardware it is assigned to. Geek Bits Each network device on a TCP/IP network needs to have an IP network address, a unique address on the network. But how do you find what it is? If you’re running Mac OS X, open up the Terminal application from your Utilities folder, and type ifconfig. This same command works on Linux as well. If you’re running Windows XP, 2000, or Vista, click Start, then Run, and then type cmd. When the command window appears, type ipconfig. 214 Chapter 6 Download at a This is the network address of the above IP address. Network address (this can vary) Host addressNotice the difference between these is in the network part of the address. connecting networks with routers IP addresses give our networks a sense of location, and network nodes a sense of belonging to that location IP addresses are used to create an address space so that different networks can communicate with each other, much like area codes relate to different geographical areas. The IP address then gives a unique network and specific address to each and every network node. Network 1 Network 2 you are here 4 215 Download at a IP Network Address 192.168.100.0/24. IP Network Address 192.168.101.0/24. The subnet mask tells you if two nodes are on the same network. If you have a network address of 192.168.0.0/16, then a node at 192.168.0.1 is on the same network as 192.168.100.1, and you don’t need a router in-between them.welcome to arp We retrieve IP addresses using the MAC address and the Address Resolution Protocol (ARP) Here’s what happens when a network device needs to send some data via a switch on a TCP/IP network. The device has to find out the MAC address using the IP address. It does by using ARP. 1 A network device sends an ARP request to the switch. I want the MAC address of the device with IP address Computer Switch 192.168.100.1. 2 The switch broadcasts the ARP request to all devices. I want the MAC address of the device with IP address Computer 192.168.100.1. Switch 192.168.100.1 216 Chapter 6 Download at aconnecting networks with routers 3 The device with the appropriate IP address makes an ARP response back to the switch. Computer Switch That’s me. My MAC address is 00:A3:03:51:0E:AC. 192.168.100.1 4 The switch relays the ARP response back to the network device. I’m told it’s the device with MAC address 00:A3:03:51:0E:AC Computer on port 4. Switch 192.168.100.1 you are here 4 217 Download at aquestion everything Q: Q: I thought I just needed a MAC address for a frame to get Who designated which IP addresses were public versus somewhere. private? A: That’s all an Ethernet frame needs to get somewhere. But, A: Good question. When the TCP/IP protocol was developed, remember from the previous chapter that Ethernet frames contain the designers recognized the need to reserve some addresses for things called packets, and these contain data in the form of use as private networks. These addresses have their own RFC, protocols. In the case of TCP/IP networks, we need IP addresses to which is RFC 1918. This designates the private address ranges. move the packets between networks. Q: So how do you get an IP address? Q: If my computer has an IP address, why does it need a MAC address too? A: Another great question. At home your computer gets its public address from your ISP. A computer at a large business or university A: A computer can talk multiple network protocols on the same would get it from the network administrator who keeps track of all network. For example, on my Mac here, it is talking TCP/IP and the IP addresses. Appletalk on the same Ethernet line. So the MAC address allows the Ethernet frames to move between network devices like routers and switches. The network protocols allow the computer to talk to Q: So how do ISPs, businesses, and universities get IP devices on other networks. addresses? Q: What is an IP address used for? A: In the US, Canada, and nations in the Caribbean, the American Registry for Internet Numbers (ARIN) manages A: Every computer connected to the Internet has to have an IP the IP address space. There are four other registry address. It may not be a public address, or it might share a public authorities for other regions of the world. You can look at address with other computers, but it will have some type of IP http://www.arin.net/community/countries.html to find the address. Registry that manages each country’s IP space. Q: Q: What do you mean “public” IP address? Can anyone get IP address space? A: There are some IP network addresses designated as private A: There are certain requirements to get IP address space. addresses. The rest are public. Public means that they are routable, Having the need ( i.e., lots of computers that need to be on the whereas private addresses are not routable, i.e., the main routers Internet) is probably the biggest requirement. But there are others of the Internet will not move packets from one network to another if as well. they have private IP addresses. 218 Chapter 6 Download at aconnecting networks with routers Below is some captured network traffic. There are several network conversations shown. Write down four pairs of communicating network nodes. No.TimeDestinationSourceProtocolinfo 221 11.424 70.13.31.201 192.168.100.1 TCP http 53605 ACK Seq 1 ... 222 11.443 192.168.100.1 70.13.31.201 HTTP GET /index.html 223 11.453 192.168.100.2 192.168.100.3 TCP http 53634 ACK Seq 1 ... 224 11.489 192.168.100.3 192.168.100.2 TCP TCP segment of of reassembled PDU 225 12.1 192.168.100.2 192.168.100.1 HTTP continuation or non-HTTP traffic 226 12.25 192.168.100.1 192.168.100.2 TCP http 53285 ACK Seq 1 ... 227 12.354 11.48.124.65 192.168.100.3 ICMP Echo (ping) request 228 12.410 192.168.100.1 70.13.31.201 TCP http 53654 ACK Seq 1 ... 229 12.478 192.168.100.3 11.48.124.65 ICMP Echo (ping) reply 230 12.499 11.48.124.65 192.168.100.3 TCP http 53876 ACK Seq 1 ... 231 12.542 11.48.124.65 192.168.100.3 HTTP continuation or non-HTTP traffic 232 12.611 192.168.100.1 70.13.31.201 TCP http 52348 ACK Seq 1 ... 233 12.619 192.168.100.3 11.48.124.65 TCP continuation or non-HTTP traffic 234 12.759 192.168.101.1 192.168.100.1 SSH SSH Encrypted request packet len=48 235 12.841 11.48.124.65 192.168.100.3 TCP http 53285 ACK Seq 1 ... 236 12.879 192.168.100.1 192.168.101.1 SSH SSH Encrypted response packet len=48 237 12.91 11.48.124.65 192.168.100.3 TCP http 53285 ACK Seq 1 ... 238 12.934 192.168.101.1 192.168.100.1 SSH SSH Encrypted request packet len=48 239 12.98 192.168.100.3 11.48.124.65 TCP http 53285 ACK Seq 1 ... 240 13.02 192.168.100.1 192.168.100.3 TCP http 53285 ACK Seq 1 ... 241 13.223 192.168.100.1 70.13.31.201 TCP http 53285 ACK Seq 1 ... 242 13.451 192.168.100.3 192.168.100.1 TCP http 53285 ACK Seq 1 ... 243 13.518 192.168.100.3 192.168.100.1 HTTP continuation or non-HTTP traffic Pair 1 192.168.100.1 Pair 2 Pair 3 Pair 4 you are here 4 219 Download at acheck out this traffic Below is some captured network traffic. There are several network conversations shown. Write down four pairs of communicating network nodes. No.TimeDestinationSourceProtocolinfo 221 11.424 70.13.31.201 192.168.100.1 TCP http 53605 ACK Seq 1 ... pair 1 222 11.443 192.168.100.1 70.13.31.201 HTTP GET /index.html 223 11.453 192.168.100.2 192.168.100.3 TCP http 53634 ACK Seq 1 ... pair 4 224 11.489 192.168.100.3 192.168.100.2 TCP TCP segment of of reassembled PDU 225 12.1 192.168.100.2 192.168.100.1 HTTP continuation or non-HTTP traffic pair 3 226 12.25 192.168.100.1 192.168.100.2 TCP http 53285 ACK Seq 1 ... 227 12.354 11.48.124.65 192.168.100.3 ICMP Echo (ping) request pair 4 228 12.410 192.168.100.1 70.13.31.201 TCP http 53654 ACK Seq 1 ... pair 1 229 12.478 192.168.100.3 11.48.124.65 ICMP Echo (ping) reply pair 4 230 12.499 11.48.124.65 192.168.100.3 TCP http 53876 ACK Seq 1 ... 231 12.542 11.48.124.65 192.168.100.3 HTTP continuation or non-HTTP traffic 232 12.611 192.168.100.1 70.13.31.201 TCP http 52348 ACK Seq 1 ... pair 1 233 12.619 192.168.100.3 11.48.124.65 TCP continuation or non-HTTP traffic pair 4 234 12.759 192.168.101.1 192.168.100.1 SSH SSH Encrypted request packet len=48 pair 2 235 12.841 11.48.124.65 192.168.100.3 TCP http 53285 ACK Seq 1 ... pair 4 236 12.879 192.168.100.1 192.168.101.1 SSH SSH Encrypted response packet len=48 pair 2 237 12.91 11.48.124.65 192.168.100.3 TCP http 53285 ACK Seq 1 ... pair 4 238 12.934 192.168.101.1 192.168.100.1 SSH SSH Encrypted request packet len=48 pair 2 239 12.98 192.168.100.3 11.48.124.65 TCP http 53285 ACK Seq 1 ... pair 4 240 13.02 192.168.100.1 192.168.100.3 TCP http 53285 ACK Seq 1 ... 241 13.223 192.168.100.1 70.13.31.201 TCP http 53285 ACK Seq 1 ... pair 1 242 13.451 192.168.100.3 192.168.100.1 TCP http 53285 ACK Seq 1 ... 243 13.518 192.168.100.3 192.168.100.1 HTTP continuation or non-HTTP traffic Pair 1 192.168.100.1 70.13.31.201 Pair 2 192.168.100.1 192.168.101.1 Pair 3 192.168.100.2 192.168.100.1 Pair 4 11.48.124.62 192.168.100.3 220 Chapter 6 Download at a Each conversation is color-codedconnecting networks with routers So what’s the problem with the Moonbase? So far we’ve seen that the computers on the Moonbase network are communicating using IP addresses rather than MAC addresses. So why aren’t the Moonbase and ISS able to communicate? Well, it looks like individually each network is working. The trouble is, the two networks aren’t communicating with each other. I wonder whether the network traffic isn’t being communicated somehow? Maybe he’s right. So far we’ve looked at how switches behave on IP networks. But what if the problems aren’t to do with the switch, but with how the traffic passes from one network to the other? What device should we look at next? Take another look at the network diagram for the Moonbase. What device controls how traffic is handled between the two networks? you are here4 221 Download at aA network device sends some network traffic. The switch decides where to send traffic based on the MAC address. program your router to cross networks How do we get network traffic to Network devices move between networks? have a default The problem is that a node on one network does not know how to gateway in their send frames to a node on another network. A router knows how to move traffic from one network to another. network setup. But how does it do this? Doesn’t it have to know about both networks, This is the router’s or at least how to get to the outside network? Also, how does a network node know to send traffic bound for another IP address. It is network to its router? where the devices We need to program a router to know about the send all network networks it is connected to, and know how to get to other networks. traffic bound for other networks. Switch Router Switch 222 Chapter 6 Download at a 192.168.2.1 192.168.1.1 The router decides where to send the traffic based on the IP address. The router has a much bigger “brain” than the switch.connecting networks with routers So why can’t you just use a switch to move data between networks? Remember, the only addresses the switch understands are MAC addresses. An Ethernet switch just looks at the MAC address of a frame and forwards that frame to the correct device. It does not modify the frame in any way. The router has to actually take the packet out of the frame, get the IP address, then modify the frame MAC address if it needs to send it on to a device on another network. Let’s take a closer look at this. you are here 4 223 Download at a r Computers are not generally connected directly to a outer. Usually there is a switch or hub in-between them. ARP request going cross-network How the router moves data across networks Here’s what happens if a network device wants to send network traffic to another network device located on a different IP network. It needs to send this traffic via a router. 1 The sending device sends an ARP request for the MAC address of its default gateway. 2 The router responds with its MAC address. 3 The sending device sends its traffic to the router. 224 Chapter 6 Download at a Traffic ARP response IP Network Address: 192.168.100.0/24