请教一个服务器 IP 和路由的配置问题

2022-04-29 11:25:16 +08:00
 miemie666

买了台 clouvider 的独服,主 IP 是 10.10.201.3 ,网关是 10.10.201.1 ,配了一个 /29 的 IPv4 段:10.12.20.96-103 ,商家说这个子网已经已经直接路由给了主 IP ,不需要提供额外的网关。请教一下 Ubuntu18.04 下如何配置呢?

3631 次点击
所在节点    云计算
8 条回复
codefever
2022-04-29 11:31:56 +08:00
查看 Ubuntu 系统的版本和网络配置文件目录
cat /etc/issue 或者 lsb_release -a
Ubuntu18.04.5 版本下的配置文件名:
Ubuntu 18.04.5 LTS
配置写在 /etc/netplan/ 01-network-manager-all.yaml 或者类似名称的 yaml 文件里

使用 NetworkManager 配置网络
点击配置按钮
输入 IP 地址和子网掩码,Apply
然后测试一下
joshu
2022-04-29 12:21:24 +08:00
随意配置
不过一般情况下额外的网段是给里分配给其它小鸡(当然作为 vpn 网段或内部其它机器使用的网段也 ok )
如果你一定要在买的这台机器上用,可以配置到 VRF 里面,也可以直接填到配置里,填写 IP 地址为 10.12.20.96/32 ,网关不用变,不影响 ARP 的,即使你没有配主 IP 也没啥关系
miemie666
2022-04-29 13:14:08 +08:00
@joshu 我想直接配置在这台机器,按照你的方法直接在原网卡上添加 IP ,但是不生效,ping 测试:
来自 10.12.20.94 的回复: TTL 传输中过期。
cnleon
2022-04-29 13:56:43 +08:00
发下 trace 看看
miemie666
2022-04-29 15:20:58 +08:00
@cnleon
目标 IP: <a href="xxx.188.96">xxx.188.96</a>

1 6.6.3.1 0 ms 0 ms 0 ms
2 100.127.248.1 2 ms 2 ms 2 ms 共享地址 AS139072
3 121.8.194.217 8 ms 9 ms 10 ms 中国 广东 广州 chinatelecom.com.cn 电信 AS4134
4 59.37.176.149 5 ms 6 ms 9 ms 中国 广东 佛山 chinatelecom.com.cn 电信 AS4134 149.176.37.59.broad.dg.gd.dynamic.163data.com.cn
5 59.43.70.5 4 ms 7 ms 12 ms 中国 广东 广州 chinatelecom.com.cn 电信 *
6 59.43.130.158 5 ms * * 中国 广东 广州 chinatelecom.com.cn 电信 *
7 59.43.187.122 5 ms 5 ms 5 ms 中国 广东 广州 chinatelecom.com.cn 电信 *
8 59.43.184.126 163 ms 163 ms 163 ms 英国 伦敦 chinatelecom.com.cn 电信 *
9 80.239.193.225 163 ms 164 ms 173 ms 英国 伦敦 telia.com AS1299 ldn-b2-link.ip.twelve99.net
10 * * * *
11 62.115.122.181 163 ms 163 ms 164 ms 英国 伦敦 telia.com AS1299 ldn-b3-link.ip.twelve99.net
12 62.115.154.43 163 ms 164 ms 164 ms 英国 伦敦 telia.com AS1299 clouvider-ic337427-ldn-b3.ip.twelve99-cust.net
13 xxx.188.95 180 ms 190 ms 475 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
14 xxx.188.94 163 ms 163 ms 210 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
15 xxx.188.95 188 ms 191 ms 213 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
16 xxx.188.94 164 ms 165 ms 209 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
17 xxx.188.95 176 ms 177 ms 178 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
18 xxx.188.94 163 ms 164 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
19 xxx.188.95 187 ms 191 ms 193 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
20 xxx.188.94 163 ms 163 ms 166 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
21 xxx.188.95 194 ms 203 ms 241 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
22 xxx.188.94 163 ms 163 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
23 xxx.188.95 196 ms 204 ms 292 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
24 xxx.188.94 163 ms 164 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
25 xxx.188.95 178 ms 181 ms 193 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
26 xxx.188.94 163 ms 163 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
27 xxx.188.95 181 ms 184 ms 186 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
28 xxx.188.94 163 ms 163 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
29 xxx.188.95 182 ms 183 ms 258 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-95.reverse.clouvider.net
30 xxx.188.94 164 ms 164 ms 164 ms 英国 伦敦 clouvider.com AS62240 hxxx-xxx-188-94.reverse.clouvider.net
FabricPath
2022-04-29 17:44:55 +08:00
ip route get 1.1.1.1
看 src ip 就是你 default 路由指定的 IP ,如果不指定,那就用这个 IP 。要想把多个 IP 用起来,除了 IP 配在接口上,还需要应用程序显式指定源 IP
FabricPath
2022-04-29 17:47:08 +08:00
@FabricPath 是我看错了,你这个无法被访问,就是商家物理网络配置的问题
miemie666
2022-04-29 17:49:48 +08:00
@FabricPath 是商家配置问题,已经发工单处理好了,谢谢大家

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/849980

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX