PDA

View Full Version : linux networking (cisco) question


Dr.MAD
08-04-2005, 11:36 AM
I got a question for you Linux specialists :)

For my next exam, we are supposed to set up a network with 2 hosts, and two Cisco routers (type Router2501a). Host 1 is connected to Router 1, host 2 to router 2, both via fastethernet interfaces and router 1 is connected to router 2 via serial interfaces.
Before I can start configuring the router, I need to give the hosts an IP address, a subnetmask and a default gateway.

... but we have to do all this in Linux. Problem is, I don't know much about Linux.
So here is my simple question: I know the commands needed to configure the routers, but what command do I have to use to assign an IP, a subnetmask and a gateway to a host?
Imagine the host's IP for ethernet0 interface should be X
the subnetmask (I know how you find that one if you have the IP) is Y
and the gateway (which is in my case the same IP as Router1's fastethernet IP address)... lets say that one is Z.

Can someone give me the exact command(s) I must insert to assign the IP, the Subnetmask and the gateway to the host?
I suck at Linux, and I suck even more at networking so I know this is probably a very stupid question, but please explain me in English :D

I hope my question didn't sound to confusing... thanks in advance

arckane
08-04-2005, 04:41 PM
from a shell, do:

ifconfig eth0 10.0.0.1 netmask 255.255.255.0
{config cmd} {network device} {IP to assign} netmask {Netmask to assign}

That will set the card to IP address of 10.0.0.1 with netmask 255.255.255.0

To set the default gateway do:

route add default gw 10.0.0.254

This would set the gateway to 10.0.0.254

Tada, easy peasy pudding and pie ;)

arckane
08-04-2005, 04:43 PM
Side note:

Once done, type "ifconfig -a" to show all devices and their status. If ETH0 hasn't appeared, do:

ifconfig eth0 plumb
ifconfig eth0 up

Then redo the IP address bit above. Usually, by doing the ifconfig command in my first post, it will configure and bring up the card :)

Dr.MAD
08-04-2005, 04:43 PM
Thanks a lot. That's exactly what I needed to know.

arckane
08-04-2005, 04:48 PM
Glad to be of service :D