我正在 Azure 云中运行一些 Ubuntu 16.04 VM。每当我重新启动 VM 时,我都必须手动设置默认网关。
网关应该由 dhclient 设置。我激活了调试并得到了这个:
root@backend01:/etc/dhcp/dhclient-exit-hooks.d# cat /tmp/dhclient-script.debug
root@backend01:/etc/dhcp/dhclient-exit-hooks.d# cat /tmp/dhclient-script.debug
Thu Jun 2 17:18:33 UTC 2016: entering /etc/dhcp/dhclient-enter-hooks.d, dumping variables.
reason='PREINIT'
interface='eth0'
--------------------------
Thu Jun 2 17:18:33 UTC 2016: entering /etc/dhcp/dhclient-enter-hooks.d, dumping variables.
reason='REBOOT'
interface='eth0'
new_ip_address='10.10.0.13'
new_network_number='10.10.0.0'
new_subnet_mask='255.255.0.0'
new_broadcast_address='10.10.255.255'
new_routers='10.10.0.1'
new_rfc3442_classless_static_routes='0 10 10 0 1 32 168 63 129 16 10 10 0 1'
new_domain_name='azure-prod'
new_domain_search='azure-prod.'
new_domain_name_servers='10.11.0.250 10.11.0.251'
Run Code Online (Sandbox Code Playgroud)
所以路由器选项设置正确。甚至租约文件也显示了正确的值:
lease {
interface "eth0";
fixed-address 10.10.0.13;
server-name "RD7CFE90879C98";
option subnet-mask 255.255.0.0;
option dhcp-lease-time 4294967295; …
Run Code Online (Sandbox Code Playgroud)