3

I have one Linux machine having two gigabit network interface. I want to run the traffic test such as iperf on two interfaces: eth0 will be server and eth1 will be client. I connected back-to-back network cables (between eth0 and eth1) and configured the ip address

ifconfig eth0 192.168.0.10 netmask 255.255.255.0 up

ifconfig eth1 192.168.0.11 netmask 255.255.255.0 up

Now i am trying to ping from eth0 to eth1 using following command:

ping -I eth0 192.168.0.11

but ping is not working, so I tried tcpdump

tcpdump -i eth0

which says ARP request is reaching to eth1—but eth1 doesn't reply

I tried another way also using

ping -I eth1 192.168.0.10 

but it is also not working

arp -a 

command says incomplete, so I am wondering why this is not working, i tried this same configuration in Ubuntu and CentOS. but no luck. The /etc/hosts file is not configured—is it required? I already tried using straight as well as cross cable.

6
  • 1
    Are you using a crossover cable?
    – jordanm
    Commented Jul 16, 2015 at 1:02
  • Is your hosts file configured?
    – eyoung100
    Commented Jul 16, 2015 at 1:22
  • is "netamsk" in your 2nd ifconfig line a copy/paste typo or a real one?
    – Jeff Schaller
    Commented Jul 16, 2015 at 1:45
  • 1
    Having two interfaces in the same /24 network on one machine won't work. What are you trying to achieve?
    – wurtel
    Commented Jul 16, 2015 at 11:20
  • I tried using crossover as well as straight cable, but it is not working. hosts file is not configured. Is it required? Also netamsk is typo in the eth1 configuration while sending the post. I have not enabled the ip_forward it is 0 in /proc/sys/net/ipv4/ip_forward. Also what i am trying to achieve is to run traffic test between two ethernet port.
    – saurin
    Commented Jul 16, 2015 at 16:02

1 Answer 1

2

This can work, but is not a normal configuration. If you want services within a server to talk via multiple IP addresses consider using multiple loop back interfaces, EG lo0 127.0.0.1, lo1 127.0.0.2. That eliminates bandwidth and physical layer issues.

That said, if the ICMP echo request is being sent and received, but not replied to, that suggests a firewall issue. Double check that no firewall rules are blocking it, possibly via flushing iptables temporarily.

2
  • i tried even shutting down the iptable service using "service iptables stop" command but even that did not help.
    – saurin
    Commented Jul 16, 2015 at 20:12
  • Any reason your services can't run on an ip address that uses the local loopback? 127.0.0.1, 127.0.0.2, etc Commented Sep 23, 2020 at 15:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .