如何在 debain 6 中获取 ppp 接口网关地址?

如何在 debain 6 中获取 ppp 接口网关地址?

我正在使用 debain 6 并使用 Sierra 调制解调器 c888 连接互联网。我正在使用 wvdial 包连接调制解调器。我能够连接互联网。我的问题是,如何获取新创建的 ppp0 接口的网关地址?以下是我的 wvdial connect 命令的输出。

$wvdial --conf=wvdial.conf CONNECT
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: AT!BAND=00
OK
--> Sending: AT+CGDCONT=16,"IP","airtelgprs.com"
OK
--> 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 27.61.17.87
--> pppd: ��d[08]�Oe[08]�}e[08]
--> remote IP address 10.64.64.64
--> pppd: ��d[08]�Oe[08]�}e[08]
--> primary   DNS address 202.56.230.5
--> pppd: ��d[08]�Oe[08]�}e[08]
--> secondary DNS address 202.56.230.6
--> pppd: ��d[08]�Oe[08]�}e[08]

答案1

route尝试在建立连接后解析命令的输出:

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

$2是网关地址:)

相关内容