如何找到PPP接口的默认网关?

发布于 2024-12-16 20:10:05 字数 97 浏览 6 评论 0原文

我使用 Debian Linux 并使用 wvdial,我能够与蜂窝网络建立 ppp 连接。正在创建 ppp0 接口,并为该接口分配 IP 地址。如何找到 PPP 接口的默认网关?

I am using Debian Linux and using wvdial, I am able to establish ppp connection with the cellular network. ppp0 interface is getting created and IP address is assigned for the interface. How do I find out the default gateway for the PPP interface?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小巷里的女流氓 2024-12-23 20:10:05

PPP 是一种点对点协议。你是一分。另一点是默认路由。

PPP is a point-to-point protocol. You are one point. The other point is the default route.

蓝海 2024-12-23 20:10:05

ppp 连接的默认路由在 /etc/ppp/options.pptpd 或 /etc/ 中有配置

default route of ppp connection has config in /etc/ppp/options.pptpd or /etc/

最偏执的依靠 2024-12-23 20:10:05

首先,您可以使用 ip 从接口信息中获取它(假设您的 ppp 接口是 ppp0):

/sbin/ip addr show ppp0 | grep peer | awk ' { print $4 } ' | sed 's/\/32//'

其次,当它是 ppp 时,您始终可以选择“默认设备路由”而不是“默认 gw 路由”。在这种情况下,无论 gw 地址如何,您都可以使用 ip:

/sbin/ip route add default dev ppp0

HTH 将 ppp0 设备添加为默认设备,
巴林特

First of all, you can grab it from the interface info using ip (assuming your ppp interface is ppp0):

/sbin/ip addr show ppp0 | grep peer | awk ' { print $4 } ' | sed 's/\/32//'

Second, when it's ppp, you can always choose "default device routing" over "default gw routing". In this case you could add the ppp0 device as your default device regardless of the gw address, using ip:

/sbin/ip route add default dev ppp0

HTH,
Bálint

红墙和绿瓦 2024-12-23 20:10:05

检查内核 IP 路由表以查找默认网关可能会有所帮助:

netstat -rn

It might be helpful to check kernel IP routing table to find default gateway with:

netstat -rn
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文