static IP setup problem
This should be simple but it doesn't seem to work.
I'm trying to setup a simple tpc/ip network. I've got a slackware distribution and a Belkin wireless router but I'm only using the wired ports. First I tried DHCP but that failed. I received an offer for a good ip address but then I timed out waiting for the response to the request. So I tried just a static ip address but I still can't see anything else on the network. It appears to be a routing setup issue, I think. My router is setup as 192.168.2.1. On my linux box I issued the following commands: > ifconfig eth0 192.168.2.10 > route -n Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo > route add default gw 192.168.2.1 > route -n Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 eth0 > ping 192.168.2.1 ...Destination Host Unreachable. What is wrong? I have another linux (montavista) machine on the network which works fine. It's routing table looks the same but without the 127.0.0.0 entry. From that machine I can ping 192.168.2.1. Oh, the montavista ip addr is 192.168.2.2. From my slackware machine I can't ping that either. Oh, netstat -i always shows 0 for the eth0 tx/rx entries. It looks like it's not trying. Sorry about the routing table format. I hope it's not too unreadable. It seems multiple spaces are colapsed into one. Thanks, Tom |
static IP setup in Slackware
Tom,
Welcome to LQ! In Slackware you should setup your network by editing the file: Code:
/etc/rc.d/rc.inet1.conf Code:
# /etc/rc.d/rc.inet1.conf In your particular example above: Code:
# Config information for eth0: Edit: The file /etc/resolv.conf is also necessary to setup your DNS servers when you run a static IP. The comp I referenced above simply has "nameserver 192.168.1.1" -- but on another box running wireless, I must enter my IP's DNS servers to use the internet. And all this can be done in Slackware by running "netconfig" as root. If you answer the questions correctly, Slackware will setup your network. This is done when you install Slackware, unless you choose to skip it. |
Thanks for the response Bill.
Actually I did run netconfig first. But thought the commands would be easier to explain. Using netconfig I have the same results. The only difference is that the metric field in the routing table is set to 1 or the default gateway. Also I entered the nameserver ip address. That's on the other side of the gw, I assume on some box run by my isp. I've also tried modifying the inet1.conf. As before the same results. |
The metric field in the routing table should be set to 1 or the default gateway.
Code:
mingdao@silas:~$ /sbin/route -n Do you have 192.168.2.10 allowed as a static IP in your router? This might be helpful: LQ vB Code List |
All times are GMT -5. The time now is 06:33 PM. |