Hi, I have some problems about lwip with two ethernet ports and it only has
one network interface card(NIC).

I handle a project that want to use one NIC to support two ethernet ports,
I add the second netif and initialize it.

    struct netif* xnetif_0;
    struct netif* xnetif_1;
    ip_addr_t ipaddr, netmask, gw;

/*set all to zero*/
    ip_addr_set_zero(&ipaddr);
    ip_addr_set_zero(&netmask);
    ip_addr_set_zero(&gw);

#ifdef CFG_NET_ETHERNET_IPADDR
    ipaddr_aton(CFG_NET_ETHERNET_IPADDR, &ipaddr); //default "192.168.1.1"
    ipaddr_aton(CFG_NET_ETHERNET_NETMASK, &netmask); //default
"255.255.255.0"
    ipaddr_aton(CFG_NET_ETHERNET_GATEWAY, &gw); //default "192.168.1.254"
#endif // CFG_NET_ETHERNET_IPADDR

//ethernetif_init(xnetif_0);
//ethernetif_init(xnetif_1);

//eth0
    netif_set_default(netif_add(xnetif_0, &ipaddr, &netmask, &gw, NULL,
ethernetif_init,               tcpip_input));
    netif_set_up(xnetif_0);

//eth 1
    netif_set_default(netif_add(xnetif_1, &ipaddr, &netmask, &gw, NULL,
ethernetif_init, tcpip_input));
    netif_set_up(xnetif_1);

eth0 and eth1 are both read .ini file to access the ip, netmask and gw,

/********device_1********/
//eth0
ip: 192.168.191.220
netmask: 255.255.255.0
gw: 192.168.191.254

//eth1
ip: 172.16.0.101
netmask: 255.255.0.0
gw: 172.16.0.254
/********device_1********/

/********device_2********/
//eth0
ip: 192.168.191.199
netmask: 255.255.255.0
gw: 192.168.191.254
/********device_2********/

//my PC
ip: 172.16.0.102
netmask: 255.255.0.0
gw: 172.16.0.101



PC<---->eth1[device_1]eth1<---->device_2

After coding, l use PC to ping eth1(device_1), it's OK, but I ping
eth0(device_1) and device_2 has some problems.

Problem 1:
The ICMP packet loss on etharp_output,  why the gw of packet is chaged to
default (255.255.0.0)??

Problem 1:
If I ping device2(192.168.191.199), ip_forward have worked exectly, but the
packet does not send to etharp_send_ip(), is it relate about arp_table??
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to