LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What's a default gateway and do I need one? (https://www.linuxquestions.org/questions/linux-newbie-8/whats-a-default-gateway-and-do-i-need-one-61465/)

Travis86 05-23-2003 09:22 PM

What's a default gateway and do I need one?
 
I'm trying to network my PS2 (running Linux, of course), but it ain't workin'. I don't have a default gateway and something tells me I need one. None of my books really say what it is or if I really need one.

manthram 05-23-2003 09:48 PM

a default gateway is the machine through which all your network traffic goes through to the other networks

what is your network setup. do you have a static ip or dhcp. if you get the ip by dhcp then it will automatically take care of it. if you did setup a static ip then you need to specify the default gateway.

Travis86 05-23-2003 10:09 PM

I have a static ip, but I assume I don't I need to define a default gateway if don't connect through another machine, right?

manthram 05-23-2003 10:15 PM

if you are connecting through other machine then the first machine in the line will be the default gateway for the second machine.


internet
|
machine 1
| |
machine 2 machine 3


now you see machine 1 will be the default gateway for machine 2 and 3. if machine 2 and 3 get their ip by dhcp from machine 1then it will automatically set the default gw. but if you are giving static ips to the 2 and 3 machines then you need to specify the default gateway.

put this line in '/etc/sysconfig/network-scripts/ifcfg-eth0'

DEFAULT GATEWAY=machine 1 ip

Travis86 05-24-2003 09:48 AM

What about computer 1? Does it need a default gateway of some sort, or is it OK to leave it blank?

david_ross 05-24-2003 10:14 AM

If it has internet access then it obviously has all the routes set. If you want internet access through another linux box you will need to enable ip forwarding and masquerading. If the other box is windows you will need to have ICS installed.

Travis86 05-24-2003 10:40 AM

No, it's not connected to the Internet. It can't even ping anything. I thought it was a problem with the default gateway, but I'm beginning to see it isn't the default gateway and something else is wrong. I have no idea what it could be now.

david_ross 05-24-2003 10:49 AM

Ok I'm getting a bit lost now. can you post (in CODE blocks) the output from the following commands on each box:
ifconfig
route -n


Do you want to have internet access or just network access?

Travis86 05-25-2003 05:44 PM

I believe the scource of your confusion is that you assume I know what I'm doing. I had a network problem where I couldn't ping anything. I knew that all the network information was correct, except I didn't have anything as the default gateway. I didn't know what a default gateway was and thought I might need one. I see now that I don't. A default gateway is kind of like your proxy server, right?

Strangely enough, everything works normally now. I don't know what was wrong, and I don't know what fixed it, but at least it works.

Thank you all for enlightening me about default gateways.

But, if you sill think it's important, here is the readout of ifconfig:

eth0 Link encap:Ethernet Hwaddr ---blah, blah, blah
inet addr:10.0.0.3 Bcast 10.255.255.255 Mastk:255.0.0.0
UP BROADCAST NUNNING MULTICAST MTU:1500 Metric:1
RX packets:111 errors:0 dropped:0 overruns:0 frame:0
TX pacets:27 errors:0 dropped:0 overruns:0 frame:0
collisions:0 txqueuelen:100

lo Link encapLocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX pacets:12 errors:0 dropped:0 overruns:0 frame:0
collisions:0 txqueuelen:0


... and here is the readout of route -n:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Ifase
10.0.0.3 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo


And yes, folks, that last addres is 127.0.0.0 . I just noticed that right now, and I don't think it's right, but I don't know enough to know if I should worry. When I ping 127.0.0.0 it says:

Do you want to pring broadcast? Then -b

When I "ping 127.0.0.0 -b" it says "pinging broadcast address". I thought my broadcast address was 10.255.255.255 . What's going on?


All times are GMT -5. The time now is 08:21 PM.