Hello,

I am using montavista embedded linux 2.6 and I am trying to do the following:

*) connect a loopback cable to the ethernet port
*) set iptables nat rules to force the packets to go out of the ethernet layer
*) after this when I ping the local ip address, it pings fine with full duplex connection, but not with half duplex connection. Following has more details: It would be great if someone would help:

####### full duplex #########################

# /usr/local/bin/ethtool eth0
Settings for eth0:
Supported ports: [ MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: yes

# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0D:00:ff:01:ee
inet addr:192.168.1.2 Bcast:192.168.159.255 Mask:255.255.224.0
inet6 addr: fe80::20a:ff:fe98:17d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:156 (156.0 B) TX bytes:426 (426.0 B)
Interrupt:23

# iptables -t nat -A OUTPUT -d 192.168.1.2 -j DNAT --to-destination 192.168.1.10
# iptables -t nat -A POSTROUTING -s 192.168.1.2 -j SNAT --to-source 192.168.1.10
# iptables -t nat -A PREROUTING -d 192.168.1.10 -j DNAT --to-destination 192.168.1.2
# /usr/local/bin/arp -s 192.168.1.10 00:0D:00:ff:01:ee

# /usr/local/bin/ethtool -s eth0 autoneg off
# <6>eth0: link is up, 100 FDX

# /usr/local/bin/miitool eth0
link status: up, auto negotiate: disabled, link speed: 100 Mbps, link duplex: full

# ping 192.168.1.2
PING 192.168.136.NAT: no longer support implicit source local NAT
33 (NAT: packet src 192.168.1.10 -> dst 192.168.1.2
3): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=141.649 ms
64 bytes from 192.168.1.2: seq=2 ttl=64 time=1.148 ms

######################### half duplex #################

# /usr/local/bin/ethtool -s eth0 duplex half
# <6>eth0: link is up, 100 HDX

# /usr/local/bin/miitool eth0
link status: up, auto negotiate: disabled, link speed: 100 Mbps, link duplex: half

# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes

--- 192.168.1.2 ping statistics ---
9 packets transmitted, 0 packets received, 100% packet loss


######################## back to full duplex ############

# /usr/local/bin/ethtool -s eth0 duplex full
# <6>eth0: link is up, 100 FDX

# /usr/local/bin/miitool eth0
link status: up, auto negotiate: disabled, link speed: 100 Mbps, link duplex: full

# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=0 ttl=64 time=1.559 ms
64 bytes from 192.168.1.2: seq=1 ttl=64 time=1.200 ms

--- 192.168.1.2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1.200/1.379/1.559 ms
#
######### end ######