Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using debain 6 and using a Sierra modem c888 to connect internet. I am using wvdial package for connecting the modem. I am able to connect internet. The question I have is, how do get the gateway address of the newly created ppp0 interface? The following is the output of my wvdial connect command.

$wvdial --conf=wvdial.conf CONNECT
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: AT!BAND=00
--> Sending: AT+CGDCONT=16,"IP",""
--> Modem initialized.
--> Sending: ATDT*99***16#
--> Waiting for carrier.
CONNECT 7200000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Fri Jun 10 05:37:27 2011
--> Pid of pppd: 5501
--> pppd: ��d[08]�Oe[08]�}e[08]
--> Using interface ppp0
--> pppd: ��d[08]�Oe[08]�}e[08]
--> pppd: ��d[08]�Oe[08]�}e[08]
--> pppd: ��d[08]�Oe[08]�}e[08]
--> pppd: ��d[08]�Oe[08]�}e[08]
--> pppd: ��d[08]�Oe[08]�}e[08]
--> pppd: ��d[08]�Oe[08]�}e[08]
--> local  IP address
--> pppd: ��d[08]�Oe[08]�}e[08]
--> remote IP address
--> pppd: ��d[08]�Oe[08]�}e[08]
--> primary   DNS address
--> pppd: ��d[08]�Oe[08]�}e[08]
--> secondary DNS address
--> pppd: ��d[08]�Oe[08]�}e[08]
share|improve this question

migrated from Jun 12 '11 at 14:12

This question came from our site for professional and enthusiast programmers.

Try to parse the output of the route command after the connection is established :

route | grep ppp0 | awk '{print $2}'

the $2 is the gateway address :)

share|improve this answer

You must log in to answer this question.