Router
From Mandriva Community Wiki
Contents |
The basis
Imagine the president of Belarus wants to set up a bilateral convenant with Madagascar. He will contact his Minister of foreign affairs, who will call the director of African affairs. This one will dictate a letter to his Belarussian-English translator. The secretary will type the translation on an official letterhead and put the letter in the international letter-box. A postman will put all the letters of that and other letter boxes into a bag and bring it to the post office, where another postman will put it into another vehicle, whose driver will bring the bag to the letter sorting office. There a mail sorter will read the address and put the letter into a bag of letters to Madagascar. A postman will take the bag and register it at the airport, where a warehouseman will put it into a plane to Paris or Roma. The pilot will bring the bag there, where a warehouseman will transfer it into a van, and another man from this van to a plane to Madagascar. In Madagascar a reverse process will take place, up to the head of the State: a man will take the bag and give it to a postman who will take it to the letter sorting office, where a mail sorter will read the address and put the letter into the box of letters for the government, etc.. Madagascar's head of State will answer through a similar process.
Each level discusses with his counterpart, at their own level, and doesn't care the details managed by the lower levels. The Ukrainian press will say: "President to conclude a convenant with Madagascar", not "Bag to be transported to the post office", and the president will announce to the media he's in discussion with the president of Madagascar, without even mentionning his Minister, not to speak of the translator. The Minister of foreign affairs will give more details about the project. Note that most postmen, at the lower levels, don't even read the address, and are not interested where the letter goes. At the driver and pilot levels, bags are transported from a place to another linked by one connection (airline...). At the lowest level, like the airport transfer, it's just a question of tranferring the bag from one vehicle to another, not even to ship it, and people tranferring luggage from a van to a plane in the airport may ignore where that plane is to fly to, a fortiori where the letter inside the bags are going to. But at the secretaries and mail sorters level, the address is written and read. These ones have a long distance view of the shipment, and know where to put the letter to send it to the destination written on the enveloppe. But a mail sorter doesn't read the content of the mail.
This is similar to the way the network works. The OSI model has 7 levels, numbered from the lowest one.
- Level 1, physical layer: the computer or other device dialog with the medium (wire, air etc.). This is the equivalent of transferring a letter from a vehicle to another.
- Level 2, data link layer: the device dialogs with a device directly connected to him, using the so-called MAC (Media Access Control) address. This is the equivalent of a point-to-point connection.
- Level 3, network layer: the device dialogs with any device on internet, using the IP (internet protocol) address. This is the routage level, the one of the mail sorters.
- We're not interested here in the upper levels, needed for the mail or web browsers, for instance.
A switch operates at level 2, and is usually ignored by upper levels: a switch doesn't need an IP address.
A router operates at level 3. A router is an automatic mail sorter, except that it doesn't only sort mails, but all kinds of computer data. As a human mail sorter routes a letter, for instance, from the national postal network into the international one and vice versa according to the enveloppe address, a router's job is to transfer data from a network to another one, typically from a local network to a broad one and vice versa, according to the IP address. So a router has two IP adresses: an address as member of the LAN (local area network) and an address as member of the WAN (wide area network). It has also 2 MAC addresses.
What do you need a router for?
You don't need a router to share an internet connexion between different computers, under the condition your Internet service provider provides you with as many IP numbers as you have computers. For this, a switch is enough, but your computers will not communicate together easier than with any computer on the net. (There is no internet without routers, but your internet service provider's router is enough for this.) You don't need a router either if you want to set a local network not connected with anything else, specially not connected with internet, i.e. if you want your computers to interact, for instance if you want to be able to read a computer's files from another computer, or if you want to send mails from one computer to another one without internet, or if you want one of your computers to be a web server for the others (intranet) without internet etc..
You do need a router if you want a local network connected to internet or, more generally, if you want to connect 2 or more networks together.
Internet access
Connection type
Before choosing a router, it's essential to know what kind of internet connexion you have. This piece of information should be in the documentation provided by your internet service provider (ISP). If you can't find it, ask your ISP. Three popular types of WAN (wide area network) connection are:
- PPPoE (point-to-point over ethernet)
- Dynamic IP with Dynamic Host Configuration Protocol (DHCP)
- Static IP
Others exist.
Addresses provided for
If your Mandriva computer already has an internet connection, put your mouse on the connection icon of the panel. You'll read: "Network is up on interface (…) IP address:(…)".
It's essential to know which version of Internet protocol your ISP uses: IPv4 or IPv6. As of 2010, most ISPs still use IPv4 (the 4th version), and the last one, IPv6, is not widely used yet, except in Japan. IPv5 is not used at all and won't be (It was an experimental one.) IPv4 addresses are represented by four decimal numbers separated by dots, and look like "202.179.0.106", while IPv6 addresses are represented by 8 hexadecimal numbers separated by colons and look like "2001:0db8:ac10:fe01:aba5:4535:ff00:0d89" (We write "represented", because, at a lower level, both are a list of 0s and 1s). It's likely that, in 2012, some ISPs suddenly switch from IPv4 to IPv6.
Any computer connected to internet is connected through a router. Hence, even if you don't have any router, your ISP has some. You should understand whether the IP address(es) you are provided for are dynamic or static. "Static" means your ISP provides you for a fix IP address or fix IP addresses, while "dynamic" means that that number changes at each connection, so that you get every day a different number (or different numbers). Obviously, a "Static IP" connexion means you get a static IP address. But, less obviously, your "dynamic" IP address may be, in fact, always the same, if your computer asks the router for an address but the latter has been taught to provide always the same given address to that computer, recognised thanks to its MAC address. A really static IP address is not asked for by the computer, but written in its hard disk. If your connection is PPPoE, you also get a dynamic IP address.
It's also important to understand if your address(es) is public or private. A public IP address is world unique, while some addresses, said "private", are reserved for private use, i.e. reserved to local networks. In IPv4, private addresses begin with "10.", with "172.x.", x being any number from 16 to 31, or with "192.168.". In IPv6, they begin with "fc00:". Any other address is public. If you're not the daughter of the chairman of one of the biggest US information technology companies (such as IBM or HP), it's nearly impossible to get a public IPv4 address now, because these addresses are nearly exhausted.
Choosing a router
There are three possibilities: you can have a modem-router "box", use a PC as router, or buy a router as a separate machine, called "dedicated router". If you choose a PC as router, it should have 2 ethernet cards: one for the WAN ("wide area network", i.e. your internet service provider side), one for the LAN ("local area network": your private network). If your router is a non-Mandriva computer, see that system's documentation. Some routers are able to connect more than 2 local networks. The number of interfaces of the router is the maximum number of networks the router can connect.
Modem-router
In most European countries, all consumer modems include a 2-interface router, so you don't need any other router to set up one local network and connect it to internet. But inside a school, for instance, you may need separate local networks, thus at least one more router. In Mongolia, modems provided by Telecom Mongolia seem not to be routers as for 2010.
Your Mandriva PC as router
This is the cheapest solution, because an ethernet card is only a few euros. If your network has only a few computers, the PC-router's performance won't be significantly affected by this extra job. Of course, when that computer is off, you won't have the net for the other ones. You will probably have to buy a switch also, but a switch is cheaper than a separate router.
Modern PCs are usually sold with one ethernet card. You'll have to buy a second one. If opening your PC would imply losing your guarantee, consider asking the seller to do it. Before buying a card, open your computer (or have it opened) and see if you have a free slot on your motherboard, and which kind of slot it is. If you don't know peripheral card slots you can ask your reseller. After buying your ethernet card, unplug the computer, open it, insert the card in the slot, close your computer, plug it in and turn it on.
Both ethernet cards will have a different MAC address and IP address. You have to choose one card for the WAN, the other one being for the LAN. If this computer had already internet access, an obvious choice is that the new card would be for the LAN, so that you don't need to change the internet access configuration.
If your computer has enough free slots, you can plug more than 2 ethernet cards. Each one stands for an interface, therefore for a potential network.
Dedicated router
A dedicated router is a router as a separate machine: in fact a specialised computer, though usually with no proper keyboard, screen or mouse, and, as far as consumer routers are concerned, much smaller than a laptop. You can find some for less than 10 €. Nevertheless, if you want to follow the criteria below, you'll have to pay a few dozens of euros. But a router for a big organization is a bigger and much more expansive machine, usually put in a rack. Criteria for your purchase:
- Your router has to be able to manage your internet connection type. If you are provided with static IP, there will not be any problem, but if you get PPPoE, dynamic address DHCP or other connection, check well.
- If your ISP provides you for an IPv4 address, choose a router with IPv4 and IPv6 ability. If not, you'll probably regret it sooner or later. If your internet service provider provides you with an IPv6 address, choose an IPv6 router.
- Choose a router with a detailled instruction manual written in a language you can read. A router is not as simple as a switch, far from it, and needs to be configured. Read that booklet carefully.
- It's advisable that your router has firewall ability, to protect your LAN from attacks from outside.
- If you want your router to deliver dynamic addresses in your LAN, for instance for notebooks, choose a router with DHCP server ability (which is different from DHCP client ability mentioned above: the ability to accept for itself a dynamic address delivered by your ISP's DHCP server).
- Decide if you want a wireless router or not. If yes, you may want to be able to disable and re-enable the wireless service, for health reasons, or/and energy saving reasons. So check if the wireless system can be disabled.
- The number of slots is not that important, because, if it's not enough, you can add a switch between one of the router slots and your extra PCs. But of course it's easier if the router has itself the needed number of slots. Don't forget the WAN (the wire coming from your "modem") will use a special slot.
- The garantee: a short time garantee or no garantee at all means the seller doesn't trust its router that much. In such a case I advise you not to trust it more that the seller.
- The price.
- If you've been provided with a soul, you might want to avoid supporting a company without the slightest ethics, even if their product is excellent and the cheapest.
Installing your router
Your router has to be installed between your modem and your computers. The modem is plugged in the "WAN" slot, while the computers are plugged in the "LAN" slots.
You may not have enough slots, specially if your router is your PC and you have more than one other PC, because ethernet cards have usually one slot only. In this case, buy a switch and install it between one LAN slot of your router and some of your PCs (or all). Switches usually don't need any configuration.
Configuring your router
Configuring your router typically consists in configuring the WAN connection, the LAN connection (and configuring the computers accordingly) and the router firewall.
- If your router is a Mandriva PC, go to Application laucher menu → Documentation → Mandriva Linux DrakXTools Guide in English, which will open a page in your web browser. There see the section called "Sharing an Internet Connection" or "Share the Internet connection with other local machines". But if you want to connect more than 2 networks, these tools will not be sufficient, and you'll have to do it by hand, I don't know how.
- If your router is a modem-router or a dedicated router, read carefully its instructions manual. Typically the configuration of your router is done through the web browser of a computer connected to it. Don't be too afraid: if you do mistakes you won't be able to correct, you'll be able to use the "reset" button of your router.
Configuring the WAN connection
Configure it according to the data given by your ISP: connection type, identifier, password… If your router is your Mandriva PC, that it was already connected to internet and that the ISP is unchanged, you have nothing to do. If your router is a separate machine but one of your PC was already connected through the same ISP, you can copy (manually) that PC configuration as the router WAN configuration.
Configuring the LAN connection
Choose between fix IP or dynamic IP given by DHCP. The former is usually better but if you have on your network a notebook which is also connected on other networks, or if you want to welcome easily notebooks to be connected just once, you may prefer DHCP with reserved address, i.e. a configuration where the addresses are alloted by the router, but the router provides any recognised computer with always the same local IP address. You also have to fix the range of IP addresses your LAN will use, to be chosen in the private ranges if your network is private. See IPv4 private IP addresses ranges or IPv6 ones. In case of reserved address, you also have to teach your router the pairs MAC address-IP address to be used. For this, you need your computers MAC addresses: for a Mandriva computer, go to Applications launcher menu → Tools → Konsole terminal, in the terminal, type
then the root (superuser) password and then, as superuser, type
Your internet card is probably named "eth0", and the MAC address may be called "HWaddr" (hardware address). For instance,
eth0 Link encap:Ethernet HWaddr 00:19:DB:5E:27:9E
inet addr:192.168.1.100 Bcast:255.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::219:dbff:fe5c:279e/64 Scope:Link
means that your ethernet card MAC address is "00:19:DB:5E:27:9E", its IPv4 address is "192.168.1.100" (private address) and its IPv6 address is "fe80::219:dbff:fe5c:279e", another notation for "fe80:0000:0000:0000:0219:dbff:fe5c:279e". For other systems, you can find the MAC address these ways.
Of course, you have to configure all the computers of your LAN accordingly, giving them a static address if you've chosen the static method, or configuring them to receive a dynamic address from your router turned into a DHCP server if you've chosen this option. It may be useful to stick a label with the IP address on each PC.
Configuring the firewall
- If your router is a Mandriva PC, in Mandriva Linux DrakXTools Guide in English, see the section called "Firewall Black/White Lists, etc.".
- If your router is a separate machine, read the router's instructions manual.
What next?
In order to become able to read some files of a computer from another computer of the LAN, you will probably be interested in installing NFS (network file system), or Samba in the case some of your computers are not Unix. Go to Applications laucher menu → Documentation → Mandriva Linux DrakXTools Guide in English, the "Network sharing" section of the page which will open in your web browser.

