Click to See Complete Forum and Search --> : NIC card and IPs not working right
NVETHIS
07-09-2003, 02:21 PM
I'm trying to set up my RH9 box as a router. My first step was to get eth0 on dchp and pull an address from my ISP. The second step was to assign eth1 an internal IP of 192.168.0.1.
This is not working however. eth0 is fine, it's pulling an IP from the cable company. I'm having a problem with eth1. I try to use the command:
ifconfig eth1 add 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0 up
and I get this error:
# ifconfig eth1 add 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
SIOCSIFNETMASK: Cannot assign requested address
SIOCSIFBRDADDR: Cannot assign requested address
This is my ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:81:03:1A:29
inet addr:xxx.xxx.xxx.xxx Bcast:xxx.xxx.xxx.xxx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3588 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:182874 (178.5 Kb) TX bytes:3916 (3.8 Kb)
Interrupt:10 Base address:0xe000 Memory:e4605000-e4605038
eth1 Link encap:Ethernet HWaddr 00:E0:81:03:1A:2A
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:455 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1177 (1.1 Kb) TX bytes:19110 (18.6 Kb)
Interrupt:11 Base address:0xe400 Memory:e4604000-e4604038
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3591 errors:0 dropped:0 overruns:0 frame:0
TX packets:3591 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:248083 (242.2 Kb) TX bytes:248083 (242.2 Kb)
How can I get this problem fixed??? I want to set up IPMASQ so other machines on my network can use this as a gateway. I"m still reading on how to do that. Any help would be appreciated. SOrry for reposting if it has been poseted before, but I'd like some fresh new specific answers ;-)
mdwatts
07-09-2003, 02:25 PM
Add the ip address etc. for eth1 in your network scripts.
/etc/sysconfig/network
Something like ifcfg-eth1
A few JL forum search results for ifcfg-eth1 (http://justlinux.com/forum/search.php?s=&action=showresults&searchid=668179&sortby=lastpost&sortorder=descending)
NVETHIS
07-09-2003, 03:16 PM
I can't get eht1 to work properly. My /etc/sysconfig/network-scripts/ifcfg-eth1 looks like this:
DEVICE=eth1
BOOTPROTO=none
IPADDR=192.168.0.1
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
ONBOOT=yes
USERCTL=no
PEERDNS=no
TYPE=Ethernet
and my route looks like this:
[root@computerxpress root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth1
67.20.191.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth1
[root@computerxpress root]#
any suggestions? I can't ping anything or get anywhere on the net :( ping: unknown host www.yahoo.com is what I get after the ping command.
mdwatts
07-09-2003, 03:27 PM
See this thread (http://justlinux.com/forum/showthread.php?s=&threadid=106434) just down from yours on dsn servers in /etc/resolv.conf.
NVETHIS
07-09-2003, 03:36 PM
I do have an entry in /etc/resolv.conf:
; generated by /sbin/dhclient-script
search frbgva.adelphia.net
nameserver 24.51.159.130
nameserver 24.51.159.133
I have not set up my dns on this box yet, because I hate going through ISP's. When I take out the IPADDR line it /etc/sysconfig/network-scrpits/ifcfg-eth1 I can get on the net and ping and be happy. ifconfig comes up with eth1 not having an assigned IP address. However, when I add the IPADDR line to /etc/sysconfig/network-scripts/ifcfg-eth1 the ifconfig command comes up with an address for the NIC, but I can't ping, can't get on the net or do anything. I'm still trying to get the routing worked out. I just doint know what the problem is??? I'm not sure where to go from here. I'm trying to get this set up as a router/firewall and it's kicking my butt :-(
mdwatts
07-09-2003, 03:45 PM
Hmmm
This is what I have for ifcfg-eth0
#!/bin/sh
#>>>Device type: ethernet
#>>>Variable declarations:
DEVICE="eth0"
IPADDR="192.168.1.4"
NETMASK="255.255.255.0"
NETWORK="192.168.1.0"
BROADCAST="192.168.1.255"
GATEWAY="192.168.1.1"
ONBOOT="yes"
DYNAMIC=""
#>>>End variable declarations
mdwatts
07-09-2003, 03:47 PM
Try using 192.168.0.2 for the ip address and save 192.168.0.1 as the gateway.
NVETHIS
07-09-2003, 03:52 PM
I'll try assigning another IP such as 192.168.0.2, but the reason that I was using 192.168.0.1 is because this box is functioning as the gateway machine i thought?
mdwatts
07-09-2003, 03:57 PM
Originally posted by NVETHIS
I'll try assigning another IP such as 192.168.0.2, but the reason that I was using 192.168.0.1 is because this box is functioning as the gateway machine i thought?
Oh yeah that's right.
It's got to be something simple. Anyone else?
Originally posted by NVETHIS
and my route looks like this:
[root@computerxpress root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth1
67.20.191.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth1Why is eth1 also associated with that 169.254.0.0 network address? If it shouldn't be (which would be my guess), delete it:
route del -net 169.254.0.0
Originally posted by NVETHIS I can't ping anything Does that include the 192.168.0.1 IP of eth1.
mdwatts
07-09-2003, 05:01 PM
Good eyes there David as I didn't even notice that.
There will be a little extra in this weeks pay for you. ;)
NVETHIS... Give what DMR suggested and see if that works.
Originally posted by mdwatts
Good eyes there David as I didn't even notice that.
There will be a little extra in this weeks pay for you. ;) You mean I'll get two dollars this week?? Yippee!
:p
NVETHIS
07-09-2003, 05:10 PM
I tried to del the 169.254.0.0 route (which I thoug looked strange) and I get this error:
[root@computerxpress network-scripts]# route del -net 169.254.0.0
SIOCDELRT: Invalid argument
[root@computerxpress network-scripts]#
I can ping 192.168.0.1 with the IPADDR line in /etc/sysconfig/network-scripts/ifcfg-eth1 as is should be, but not if I remove the IPADDR line (which is the only way i can get on the net) I nned to conquor this!!!!!!
mdwatts
07-09-2003, 05:15 PM
Either verify the syntax in the route manpage (man route) or see if you can find 169.254.0.0 in one of your network config scripts.
NVETHIS
07-09-2003, 05:35 PM
I tried every combination and read the man pages, the syntax should be correct. I even tried route add -net 10.0.0.0 and it added that route. Now I can't delete the darn thing. However, looking at some of the network scripts I found this in /etc/sysconfig/network-scripts/network-functions-ipv6:
## Test a given IPv4 address for not a private but unicast one
# $1: <IPv4 address>
# return code: 0=ok 1=argument error 10=private or not unicast
ipv6_test_ipv4_addr_global_usable() {
local fn="ipv6_test_ipv4_addr_global_usable"
local testipv4addr_globalusable=$1
if [ -z "$testipv4addr_globalusable" ]; then
return 1
fi
# Test for a globally usable IPv4 address now
# test 0.0.0.0/8
/bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=0\.0\.0\.0" && return 10
# test 10.0.0.0/8 (RFC 1918 / private)
/bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=10\.0\.0\.0" && return 10
# test 127.0.0.0/8 (loopback)
/bin/ipcalc --network $testipv4addr_globalusable 255.0.0.0 | LC_ALL=C grep -q "NETWORK=127\.0\.0\.0" && return 10
# test 169.254.0.0/16 (APIPA / DHCP link local)
/bin/ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=169\.254\.0\.0" && return 10
# test 172.16.0.0/12 (RFC 1918 / private)
/bin/ipcalc --network $testipv4addr_globalusable 255.240.0.0 | LC_ALL=C grep -q "NETWORK=172\.16\.0\.0" && return 10
# test 192.168.0.0/16 (RFC 1918 / private)
/bin/ipcalc --network $testipv4addr_globalusable 255.255.0.0 | LC_ALL=C grep -q "NETWORK=192\.168\.0\.0" && return 10
# test 224.0.0.0/3 (multicast and reserved, broadcast)
/bin/ipcalc --network $testipv4addr_globalusable 224.0.0.0 | LC_ALL=C grep -q "NETWORK=224\.0\.0\.0" && return 10
return 0
}
Have no idea what all that is, and if it is even relevant, but in no other place does that IP address appear.
mdwatts
07-09-2003, 05:43 PM
Maybe it's normal or you can try commenting out that line.
Originally posted by NVETHIS
I tried to del the 169.254.0.0 route (which I thoug looked strange) and I get this error:
[root@computerxpress network-scripts]# route del -net 169.254.0.0
SIOCDELRT: Invalid argument Hmm, sorry- I might have been a little confuzzled in my syntax; try some of the alternative versions of the "del" directive of the route command in these links (http://www.google.com/linux?q=%22route+del+-net%22&hl=en&lr=lang_en&ie=UTF-8&start=20&sa=N).
homey
07-09-2003, 10:24 PM
I wonder if you would care to use the command: redhat-config-network ?
This brings up a GUI tool which may make it easier for you to see what is what.
For instance, under the devices tab you should see two devices. You can highlight one or the other and click on Edit to get to some more options like what Hardware Device it is....
Also you can check a lot of other information like the Hosts and DNS tabs.
freakmn
07-09-2003, 10:36 PM
Originally posted by NVETHIS
any suggestions? I can't ping anything or get anywhere on the net :( ping: unknown host www.yahoo.com is what I get after the ping command.
I would attempt to fix that problem first. If you can't get out to the internet, your gateway would be useless. Have you tried pinging a known IP address to make sure the problem isn't a bad DNS setup? (yahoo's IP=66.218.71.198)
cowanrl
07-10-2003, 10:06 AM
169.254.0.0 is another private IP address range. It's basically used for machines to "self assign" themselves an IP address.
I know if a Win2k or greater machine that is configured for dhcp comes up and detects a network connection but can't locate a dhcp server, it will assign itself an ip address on the 169.254.0.0 network.
Either the new versions of the Linux kernel are now supporting this or maybe it's the latest dhcp clients, I'm not sure. But I know it's starting to show up the Linux world now.
The presence of the 169.254.0.0 network in the routing table will have no affect on the operation of networking. Since a 169.254 address will never appear on the Internet, the packets will always be routed through a local interface, in this case eth1.
I checked on my Red Hat 9 machine and it has the same entry in it's routing table. It's using dhcp.
I wouldn't worry about that entry in the routing table unless it happened to show up on an interface that was connected to the Internet.
NVETHIS, you main problem stems from the fact that the default gateway shown in your routing table is on the 192.168.0.0 network(192.168.0.1 on eth1). That means that any time you tried to send a packet to the Internet, it would be routed to your local network.
It looks like for some reason, you are not getting the default gateway properly from your ISP or it's being overwritten by the scripts that are bringing up networking in Red Hat 8.
Since you say that you can access the Internet OK if you don't bring eth1 up, here's what I'd do:
- In /etc/sysconfig/network-scripts/ifcfg-eth1 change it to onboot=no. That will keep eth1 from coming up.
- Restart the machine and and check to see if you can access the internet.
- If you can, look at the route table and see what the default gateway is. It should be something on the 67.20.191.0 network.
- edit /etc/sysconfig/network-scripts/ifcfg-eth1 again, set onboot=yes and add the line GATEWAY=67.20.191.x to it. Use the ip address that showed up as the default gateway in the route table.
- Reboot and see how that works.
Another thing to check, look in the file /etc/sysconfig/network and make sure there is no line in there that says GATEWAY=192.168.0.1. A default gateway can also be set in that file and it could be orverriding the default gateway you are receiving from your ISP.