View Full Version : [ubuntu] How to ping eth0 from eth1 on my linux machine?

October 20th, 2010, 03:49 PM
I have a linux machine with 2 ethernet ports(eth0 and eth1). eth0 is connected to a router which assigns it an IP address eth1 is connected to a switch and I assigned it an IP address using "ifconfig eth1 netmask up". How do I ping eth0 from eth1?

October 20th, 2010, 04:02 PM
Is the switch also connected to the router?

October 20th, 2010, 04:04 PM
No. Its not.

October 20th, 2010, 04:39 PM
eth1 has to be connected to a network in order to ping another computer, you'll have to connect eth1 to the same router as eth0 to make it work.

October 20th, 2010, 04:48 PM
No. Its not.

Then your question makes no sense. How do you expect the packet to get from one to the other without a connection between them?

October 20th, 2010, 06:40 PM
First it's certainly possible to ping one interface on a machine from another like this:

ping -I eth0 ip.addr.of.eth1

however the OP's setup probably won't work as configured. First you'll probably need to enable IP packet forwarding in the kernel by setting the "net.ipv4.ip_forward" switch to 1 in /etc/sysctl.conf and rebooting. Second you need to assign eth1 to another network besides Give it and you should be able to run

ping -I eth0