gateway IP address

Could someone refer me to a good explanation of how the gateway IP address is used in networking?

I have a Cisco ATA186 analog telephone adapter, and it requires me to configure gateway IP address. It only has one RJ45 Ethernet port, so shouldn't it just be sending all the packets out of the port? Why would it need a gateway IP address?

Reply to
mike7411
Loading thread data ...

Networking is all about encapsulation. Ethernet is Layer 2, IP is Layer 3. Layer 2 uses MAC address, and Layer 3 uses IP address. IP packets are encapsulated into Ethernet Frames. ARP is used to obtain the MAC address of a device on YOUR IP subnet. If you have two segments connected via a router, and you want to talk to a device on the other segment, you need to send the Ethernet frame to the router, so that it can pass it to the device on the other segment. You need to configure the default gateway (the routers IP address) so that you device can figure out the MAC address of the router. Example.

Device A on Subnet 1, needs to talk to Device B on Subnet 2. Subnet 1 is connected to Subnet 2 via router R. Device A has a packet that it needs to Device B. It knows that the Device B is on a different subnet (IP address and subnet mask are used for this purpose), it knows that it needs to send the packet to the router (default gateway). When the packet leaves Device A, the source IP is itself, the source MAC is itself. The destination IP is Device B, the destination MAC is the router. The router gets the frame (because the destination MAC of the Ethernet frame is addressed to it), looks at the destination IP and determines where to send it, (in this case, a directly connected subnet.) When the frame leaves the router, the source IP is Device A, the source MAC is router, the destination IP is Device B, and destination MAC is Device B.

This is a very simple example.

For more information on the "Layers" (There are seven of them) Google "OSI Model" This will give you a more complete explanation of the workings of networking.

Scott

Reply to
thrill5

A nice answer but I rather think not to the question as asked. I suspect that the true answer is that the logic used is in the device is general and hence applies to an IP node with multiple interfaces.

Chris Mas> Networking is all about encapsulation. Ethernet is Layer 2, IP is Layer 3.

Reply to
Chris Mason

A good reference would be Comer's Internetworking with TCP/IP, Volume I, Principles, Protocols and Architecture. Relevant chapters would be Chapter 5 Mapping Internet Addresses To Physical Addresses (ARP), and the Routing chapters.

The gateway IP tells the client (the ATA186 in this case) where to send packets that are not on the same subnet or subnets as directly attached interfaces. In this case, since there is only one interface there will likely be only one attached subnet. The gateway IP tells the client where to send packets that are not on that subnet.

Since a router attached to a subnet can pretend to be any host not on the same subnet if proxy-arp is enabled, a gateway IP is not always necessary, even when the client has multiple interfaces.

If you are always sending packets to the same subnet, neither a gateway IP nor proxy-arp is needed, although it sounds like your client still wants you to enter one.

In any case, the gateway IP has nothing to do with the number of interfaces your device has.

Reply to
erik.freitag

snipped-for-privacy@gmail.com schrieb:

yes it should send all packets out of this port, question is _where to_.

here a shorter explanation:

a device needs a gateway for ANY adress that is NOT in its own subnet. ipadress and netmask define which range the device considers as its own net. any interface needs to have a route for packets, whose destination is not the default gateway and not the local subnet..

imagine a room with one door. anypacket with destination _not in the room_ has to know where to get out. the door is the default gateway.

of course you can have several doors to different destinations.

and remember: your gateway has to be an adress in _your_ range, never in the destination net. (because you would't know how to get there , right :-)

Reply to
sillymartin

How does gateway information get sent out when there is no such field in an IP packet?

formatting link
snipped-for-privacy@gmail.com schrieb:

Reply to
mike7411

I'm not sure what you mean here. The gateway isn't in the packet. The routing device makes a decision based upon the routing table and forwards the packet to the correct outbound interface. The packet only has the source and destination IP addresses. It doesn't contain information on how to get from one to the other. Devices that route IP packets decide how they are routed / switched.

For example, if you look at the route table on your PC you will most likely have a default gateway address configured (either statically or via DHCP) which may be your local internet router or firewall. This is the next hop address for your non-local IP traffic. It isn't 'in the packets', it's in the routing table of your PC. Your router/firewall then might have a default gateway of your ISP's edge device. Each device is making a routing decision based on the destination IP address in the packet.

Chris.

Reply to
chris

If it's not in the packets, chris, what is the point of a host with only one Ethernet port having a gateway IP address?

Thanks.

chris wrote:

Reply to
mike7411

The IP packets are encapsulated in layer 2 frames. This is where your default gateway comes in. For packets not local to your subnet, the destination mac-addresss will be the mac-address of your default gateway.

Doan

Reply to
Doan

The point is who will carries that packet out of your local network. For local machines, you have the mac-addresses (through ARP) of the destinations, but for non-local machines, the default-gateway will arp for non-local machines.

Doan

Reply to
Doan

Because the host will not know how to reach anything outside of it's local subnet. Any routing device (router or host with a single connection) needs to know where to send packets if the destination address is unknown.

For example,

C:\\Documents and Settings\\Chris>route print =========================================================================== Interface List

0x1 ........................... MS TCP Loopback interface 0x2 ...00 30 1b b0 bd fe ...... NVIDIA nForce MCP Networking Adapter - Packet Sc =========================================================================== =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.19.72.1 10.19.72.2 30 10.19.72.0 255.255.255.0 10.19.72.2 10.19.72.2 30 10.19.72.2 255.255.255.255 127.0.0.1 127.0.0.1 30 10.255.255.255 255.255.255.255 10.19.72.2 10.19.72.2 30 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 224.0.0.0 240.0.0.0 10.19.72.2 10.19.72.2 30 255.255.255.255 255.255.255.255 10.19.72.2 10.19.72.2 1 Default Gateway: 10.19.72.1 ===========================================================================

You'll notice a route of 0.0.0.0 with a mask of 0.0.0.0 and a gateway of

10.19.72.1. That's my default gateway. If I remove that then I won't be able to get out to the internet because my PC will only know about the 10.19.72.0 /24 network. The point of the default gateway is to say 'for any destination that doesn't have a specific route, send packets to this address'.

Chris.

Reply to
chris

Reply to
Chris Mason

Hi,

You're not wrong - it is just the code used in the product. However, that 'code' is in every IP-enabled device, it's just the mechanics of how IP works. And the number of interfaces on the device doesn't affect how IP does its thing.

An Ethernet (Layer 2) network is a 'local' environment, and it's very good at communicating with other nodes in the local area. But Ethernet itself doesn't know how to - and isn't designed to - get to nodes on remote networks. To help solve this problem, a gateway IP address can be used. Although it's an IP address that you configure on the node, the gateway address is actually used by Ethernet, basically to help Ethernet when it says 'the place I'm trying to get to isn't local, now what?' The gateway address provides a pointer for Ethernet to use in situations where the destination isn't local.

BTW, it's not mandatory to have a gateway address configured on a device. If a device is on a LAN, and it will never need to talk to any other nodes besides those on that LAN, the gateway address is never used.

Kieran

Chris Mas> I have now seen many nice answers and the OP has emphasised his

Reply to
kieranmilne

I see. Is there any practical way to look at layer 2 data?

It seems Ethereal only captures higher layers.

Thanks.

snipped-for-privacy@gmail.com wrote:

Reply to
mike7411

There is likely an option to Ethereal to get it to output the information. For example, in tcpdump,

-xx Print each packet, including its link level header, in hex.

(the option would likely be named slightly differently in Ethereal.)

Reply to
Walter Roberson

Kieran,

I have to apologise. I suspected that Mike - I assume - wasn't getting his question answered but I was having a mental block about why. Indeed it is relevant to talk about ARP processing and the fact that all IP packets need to be routed by MAC address across the Ethernet to the "gateway" node - and - here's the point - potentially there may be more than one other node connected to the Ethernet so just having one way out says nothing about which of these multiple nodes is going to pick up the packet for, typically, onward routing.

But maybe Mike - as I do in my office here - has just one cable connecting his PC to the router, inevitably the "gateway". Now there doesn't seem any longer to be any need to identify which IP node on the Ethernet is going to be the "gateway". To borrow a phrase from an election campaign, "It's the box at the other end of the cable, s*****."

Under the circumstances just described having to configure the box at the other end of the cable seems excessive. However, understanding (1) that using a "yellow" cable - are these "cross-over" cables always yellow? - is a special case which the IP logic is entitled not to know about and (2) that nobody writes IP logic from scratch but picks up some existing already explains why the "gateway" specifuication is necessary.

Incidentally, the possibly simple answer to "looking at layer 2 data" for Mike is to display the ARP table. This will show how MAC addresses are associated with IP addresses. My arp -a shows just my router/"gateway" node, of course.

Chris Mas> Hi,

Reply to
Chris Mason

The problem is that the devices don't know they're at the ends of a single cable. The NIC on the router doesn't know that every packet it sees should be processed, rather than just the ones with its MAC address.

Reply to
Barry Margolin

No need to apologize Chris, I think we're all on the right track here. :)

You're bang on for the one-way-out premise. Ethernet is, by design, a multi-access environment. Which means we get to use a single Eth interface to the LAN, and Ethernet takes care of which specific node we're actually trying to get to on that LAN (taking its cue based on the destination IP address).

The PC-directly-to-router situation is interesting. You're bang on again that it seems excessive to have to do the configuration when you're effectively directly connected. But there are two things to keep in mind:

1- as was correctly said elsewhere, Ethernet doesn't know you're directly connected - to Ethernet it's a multi-access network that just happens to have two nodes on it. The irony, as you point out, is that you will never send local traffic! 2- the reason you're connecting to the other node makes a difference. Connecting to a node that is the destination for your traffic is very different than connecting to a gateway, whose function is more like a relay, to pass your traffic along down the line.

So we're back to 'the way IP works'. :) In short, for routed environments you still need the node to have both the IP address and a gateway address. Although IP isn't as 'local' as Ethernet overall, one main function of an IP address and subnet mask is to give you an address on a network, and define what network you are on (i.e. what you are 'local' to). When you want to send a packet, your node cross-checks the destination IP address against your own address. It's actually right then that the determination is made whether or not the destination is local. And if it's not local traffic, it's also right then that you need that alternate place to go, a pointer to another node that knows how to get your non-local traffic to its destination. Enter the gateway IP address. So for your PC-router situation, you need your IP address in order to be identified as a valid node on your local network (to receive incoming traffic from the router, for example). And your outgoing traffic would always be non-local, which means referencing the pointer (gateway IP address) to trigger Ethernet to send traffic to the gateway node.

Kieran

Chris Mas> Kieran,

Reply to
kieranmilne

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.