eth0 fixed IP. eth1 DHCP gateway. Need access to eth0
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
That sounds fine but if I had any idea how to modify the "default" routes already set up I would happily do so. As I already have said WTF are these routes set and in what file?
They certainly don't show in Network Manager GUI and none of the suggested paths/files contain this information.
the routes are added in 2 ways.
ifconfig
route
Quote:
Originally Posted by evilted
Code:
ifconfig eth0 172.16.0.1/24
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.0.0 * 255.255.255.0 U 0 0 0 eth1
why not start again? everything has gotten confusing and out of control. you want the control back.
unplug everything except your netcat thing (or the device your having problems with). Most people forge to isolate things, setup your network. make sure you can reach your device BEOFRE you start expanding your network.
/etc/sysconfig/network-scripts/*
* can equal things like -> ifcfg-eth0
i use centos, and this (above) is the location for the network config at boot time (or when i execute the command 'service network restart'), and yes there are other places, but i would start here, and i would restart your network/machine to see what it is set to.
check the files here (or whereever they are for the distro your using).
a default gateway doesnt really matter, you can remove it:
route del default gw x.x.x.x
having a default wont matter because you are on the 192.x.x.x/24 and you are trying to reach a host on the same net/subnet. the default is basically where it goes when it doesnt match something in the routing table. (eg, you have 192.x.x.x and if you try to reach 4.2.2.1 then it wont find it in your routing table, and will then goto the default)..
Correcting eth0's bad IP address should eliminate the bad routing table entry after rebooting. Look at the link I provided in post #29.
From the article:
Code:
/etc/network/interfaces
and the static routes in the following format:
up route add [-net|-host] <host/net>/<mask> gw <host/IP> dev <Interface>
If you keep both interfaces on the same network address and the same subnet, then try adding a host route in this file.
I think you man also need to delete the net route entry for eth0, so it doesn't interfere with eth1 which should be used for 192.168.1 traffic not going to 192.168.1.6. Having two route entries to the same network (192.168.1.0) may cause problems. Look in the /etc/network/interfaces file and see if configuring eth0 created a net route command. If so delete it, if not, add a route command to delete it. The third one below is what I am referring to.
The best solution is to change the default IP address for the embedded device, so it is on a different network. Then configure the IP address of eth1 so it's on the same network. You wouldn't need a host route in that case.
Hey, guys. I have too much information to follow here.
So I took out both NICs, cleaned out ..etc/networks/interfaces ('cept for loopback) and rebooted.
Both route and ifconfig are now empty.
Reinstalled eth1 and get:
Code:
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
default 2WIRE133 0.0.0.0 UG 0 0 0 eth1
and can connect to the Net, (as you see).
BTW, why do I see 192.168.1.0?
And the next, (simple idiot newbie language, please), step to put eth0 (192.168.1.20) in connection with 192.168.1.6?
That's because your 2wire133 router is setting it. Actually, it might be a good idea to login to your router and change your internet-facing nw side to a different address, which would make this routing a little bit simpler.
i'm trying to keep my posts short and to-the-point to try and minimize the confusion (hopefully) and also to give other more knowledgeable people a chance to chime in. (also this way i will have more posts :> ).
if you're unable to change any of the ip addresses, is it possible to hook the 192.168.1.6 machine up to the router as well and let that deal with the routing? only thing is that all your traffic will be routed through eth1; would it make a difference? If you decide to do that, just be sure to mark the 192.168.1.6 ip address as static in the router.
~$ sudo ifconfig eth0 192.168.1.20 up
~$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:30:BD:70:34:12
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xe000
This is up?
Oh. Physically almost impossible to hook up to external router
Looks like it is up. if you do ifconfig without the -a, it will only show you interfaces that are up.
step two:
Code:
route add -host 192.168.1.6 gw 192.168.1.20
to verify:
Code:
ping 192.168.1.6
traceroute 192.168.1.6
And that's it. you can add a third step to make the route permanent by looking at some of the previous posts. But, if this doesn't work, then i'm out of ideas. perhaps someone with more experience can show us the path (pun intended! )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.