# Routing Table Ethernet and PPP

**URL:** <https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730>\
**Category:** NET+OS\
**Created:** [April 7, 2004, 9:32am UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730 "2004-04-07T09:32:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [April 7, 2004, 9:32am UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/1 "2004-04-07T09:32:25Z")

</div>

I have following problem. My application connects to a ISP (active connection mode) via a GSM modem. The device gets a public ip address. But i cannot ping it. The problem is that the device routes the packets to the ethernet plug. For Example: Ethernet is configured as 192.168.2.244. I want my application to route all packets to ehternet if it is 192.168.2.x ( 255.255.255.0 ), all other packets received from ppp should be routed trough ppp (com1). As I have only PPPAddRoute function I am not able todo this. Knows someone how to solve this problem.

---

<div class="post-metadata">

**Author:** ![tmaltesen](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tmaltesen](https://forums.digi.com/u/tmaltesen)\
**Post date:** [October 2, 2004, 12:36pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/2 "2004-10-02T12:36:27Z")

</div>

If you want all packets routed to the PPP channel you should change the default route to be the PPP interface instead of the ethernet. You can use the following two functions: extern int ip\_add\_static\_route(char \*devname, u32 daddress, u32 subnet, u32 gateway, int cost); extern int ip\_del\_static\_route(u32 ip\_address, u32 ip\_mask); First delete the existing default route that is directed to the ethernet interface, you do this by deleting static route with destination 0.0.0.0 & mask 0.0.0.0. Then add a new static route to device name “ppp0”, destination 0.0.0.0, mask 0.0.0.0 and set gateway to the assigned ip address (PPPGetPeerAssignedAddresse()), the cost is 1. Note, I belive you should do this after the link us up. Best regards, Thomas Maltesen Prolon Control Systems

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [May 5, 2004, 11:08pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/3 "2004-05-05T23:08:29Z")

</div>

Chris, I had this same type of problem. Make sure you call NAIpSetIpForwarding(TRUE) in your app. You can call it sometime at the beginning of the app. You will also need to have your routing table correct on your PC (on the ethernet) to default route to the ethernet interface on the NetSilicon board. You should also add a default route using the PPPAddRoute to route everything except the ethernet subnet out the ppp interface. Use the PPPGetPeerAssignedAddress to get the address for the default route. When the ethernet interface comes up, a route will be added for it that will automatically do what you want on the ethernet link, provided the netmask is correct. Hope that helps.

---

<div class="post-metadata">

**Author:** ![FlexyZ](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@FlexyZ](https://forums.digi.com/u/FlexyZ)\
**Post date:** [October 1, 2004, 11:43pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/4 "2004-10-01T23:43:41Z")

</div>

HiI am dialing my ISP, and can get the “PPPGetPeerAssignedAddress”, but how can I get the Public IP assigned from the ISP? Thanks Felix

---

<div class="post-metadata">

**Author:** ![FlexyZ](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@FlexyZ](https://forums.digi.com/u/FlexyZ)\
**Post date:** [October 2, 2004, 1:05pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/5 "2004-10-02T13:05:00Z")

</div>

HiThanks I will try that 🙂 btw. Where is the documentation for the “ip\_add\_\*” functions, I can’t find it in the API Reference. So the PPP public IP and gateway adress is the same? - normally there is a gateway and a public ip adress assigned from the ISP right? I working on a GPRS modem, and for starters I am dialing analog, when using GPRS the dial string is a little different. Thanks Felix

---

<div class="post-metadata">

**Author:** ![FlexyZ](https://avatars.discourse-cdn.com/v4/letter/f/41988e/32.png) [@FlexyZ](https://forums.digi.com/u/FlexyZ)\
**Post date:** [October 2, 2004, 1:39pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/6 "2004-10-02T13:39:52Z")

</div>

HiThere is success 🙂 Thanks a million Meaning that I can ping the Public IP (PPPGetPeerAssignedAddress) from my PC Felix

---

<div class="post-metadata">

**Author:** ![sameer\_87](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@sameer\_87](https://forums.digi.com/u/sameer_87)\
**Post date:** [November 8, 2004, 12:37pm UTC](https://forums.digi.com/t/routing-table-ethernet-and-ppp/5730/7 "2004-11-08T12:37:13Z")

</div>

Hi,(I am not able to ping) I connect to internet using dial-up connection via GSM modem (Wavecom) and the ISP is Vodafone. It gets connected fine and I am able to browse the internet as well. But, I am not able to ping a website. Though, when I ping, I am able to resolve the domain name. I don’t know whether it is a latency problem or the routing problem. Cheers! Sameer
