重庆荣昌网站建设价格,做汽车网站怎么挣钱,建站程序的价钱,北京网站建设公司服务哪家好记录一下配置服务器过程#xff0c;本以为简单#xff0c;结果整了一天。
服务器有2个网口#xff0c;网口2是用来上外网的#xff0c;原来用的01-netcfg.yaml进行ip地址设置#xff0c;主要就用2条命令#xff1a;
vi /etc/netplan/01-netcfg.yaml #xff08;打开后…记录一下配置服务器过程本以为简单结果整了一天。
服务器有2个网口网口2是用来上外网的原来用的01-netcfg.yaml进行ip地址设置主要就用2条命令
vi /etc/netplan/01-netcfg.yaml 打开后进行修改 netplan apply 应用配置不正确会报错
起初配置的01-netcfg.yaml内容
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no dhcp6: no addresses: [172.18.36.110/24] gateway4: 172.18.36.1 nameservers: addresses: [172.18.36.1] eno2: dhcp4: no dhcp6: no addresses: [192.168.110.110/24] gateway4: 192.168.110.1 nameservers: addresses: [192.168.110.1]
eno2是外网网口打死都ping www.baidu.com都不通的。但ping外网的网关192.168.110.1是通的。
后来想起是不是默认就是用第1个网口去连外网的用route -n一看果然是。网上也没告诉方法把第2口设置成默认的网关那就把第1口的网关和域名服务器删了就应该是第2口作为默认网关了吧
新配置如下
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no dhcp6: no addresses: [172.18.36.110/24] gateway4: 192.168.110.1 eno2: dhcp4: no dhcp6: no addresses: [192.168.110.110/24] gateway4: 192.168.110.1 nameservers: addresses: [192.168.110.1] 之后netplan apply但是服务器依旧ping不通route -n依旧不变的那可能需要重启reboot漫长等待后route -n果然变成192.168.110.1作为网关排到前面的了。ping www.baidu.com就通的了。
正确的状态 rootubuntu:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.110.1 0.0.0.0 UG 0 0 0 eno2 0.0.0.0 172.18.36.1 0.0.0.0 UG 0 0 0 eno1 172.16.20.0 0.0.0.0 255.255.252.0 U 0 0 0 eno2 172.18.35.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2 172.18.36.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1 192.168.110.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2
//ping 域名服务器地址 rootubuntu:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq1 ttl108 time186 ms 64 bytes from 8.8.8.8: icmp_seq2 ttl108 time185 ms
//ping 百度 rootubuntu:~# ping www.baidu.com PING www.a.shifen.com (180.101.50.188) 56(84) bytes of data. 64 bytes from 180.101.50.188: icmp_seq1 ttl50 time7.97 ms 64 bytes from 180.101.50.188: icmp_seq2 ttl50 time7.70 ms 64 bytes from 180.101.50.188: icmp_seq3 ttl50 time7.70 ms