Do routers have IP Addresses?
Do routers have IP addresses, if so then how many? and how can I get the IP addresses of the router if connected to a LAN?
According to me it can have only one IP address, it cannot have multiple addresses. Please correct me if i am wrong, or does there exist a situation where it can have multiple addresses?
Thanks.
An IP router has to have a minimum of 2 IP addresses, because its function is deciding on where to send the packet next. A minimal configuration of TCP/IP network where you need a router is a connection between two networks with different network part of the network addresses.
Many times there is also another IP address for management purposes, so you can say that it is the router's own address, but it has nothing to do with the function of router as its merely a convenient access.
So a minimum is one incoming interface and one outgoing interface each of which has to have a different IP address to differentiate them. There can be as much as you want, taking care of many network interconnections, provided you have the needed resources (RAM, CPU, network interfaces, ...).
If there is no choice, there is no routing function so even if you call the box an IP router, it is not. :)
Links to learn more:
http://en.wikipedia.org/wiki/Router
http://searchnetworking.techtarget.com/sDefinition/0,,sid7_gci212924,00.html
http://computer.howstuffworks.com/router.htm
Edit: Just found an über excellent explanation of routing which contains all needed knowledge: How does IPv4 Subnetting Work?
Routers usually do, but don't have to have IP addresses. Routing itself does not require any of the interfaces to have an IP bound to them. When a packet arrives on any interface, the IP headers get inspected, primarly the destination IP. That gets compared against the routing table, and as long as it fits into one of the specified ranges (or the default route if not), it gets put on the corresponding INTERFACE, not IP. At no point in this process the router needs it's own IP. The only reason they have them is so you can access them remotely for maintenance, or to easily keep track of which interface belongs on what network.
The short answer is:
Yes. By definition, a router must have more than one interface (with an IP address per interface) to send and receive packets and forward packets from one to the other based on the destination addresses of the packets. Not all routers speak only IP, but "multi-protocol" routers are not really necessary now that everything speaks IP.
The more complex answer is also yes...
The typical implementation of a router has an IP address per "directly attached network" or subnet the router can reach via a local network. (ie if the router has an address 10.10.10.1/23 it can reach any IP address between 10.10.10.1 through 10.10.11.254 from that interface). Hosts on that layer 2 network and in that address space would be configured to use 10.10.10.1 as their "default route" so any traffic not going to 10.10.10.1/23 would be given to the router to send to the final destination. At this point, hopefully the router has one more IP address which it uses to communicate with that router's default route (or the other directly attached network that has the destination address).
In addition to having more than one IP address, routers may even have more than IP network such that the same IP address exists on several different subnets in the router and the router knows that if traffic from interface A is destined to 10.10.10.10 it goes out interface C, but if it comes in from interface B it must go to interface D. The two most common situations where this can happen are with management networks or with "virtual routers" where a single router is partitioned into different virtual routers for different non-related clients.
It is even possible for a thing that I would call a router to not have an IP address, such as if you have what everyone else calls a "firewall" in bridging mode that enforces policy routes. Such a device would be a nightmare to support and confuse the people who take over for you after you're fired, but it does route and it doesn't have a local IP address. (the lunatic who implements such a thing would obviously manage it from a serial port, right?)
Yes, and pretty much as many as you wish, as for how to get the address - well that's a much bigger question that needs a bit of thought. Why don't you ask us what you really want to know and maybe give us some better/more information.