interface GigabitEthernet0/0
ip address 172.16.1.254 255.255.255.0
no shutdown
service dhcp
ip dhcp excluded-address 172.16.1.254 172.16.1.254
ip dhcp pool LAN1
network 172.16.1.0 255.255.255.0
default-router 172.16.1.254
dns-server 8.8.8.8
interface GigabitEthernet0/0
ip address dhcp
no shutdown
DHCPクライアントの動作確認
Router2で下記のコマンドを実行し、ネットワーク情報が割り当てられたことを確認します。
Router2
show ip int brief
Router2#show ip int brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 172.16.1.1 YES DHCP up up
GigabitEthernet0/1 unassigned YES unset administratively down down
GigabitEthernet0/2 unassigned YES unset administratively down down
GigabitEthernet0/3 unassigned YES unset administratively down down
Gi0/0にIPアドレスが割り当てられたことを確認できます。
show ip route
Router2#show ip route
Gateway of last resort is 172.16.1.254 to network 0.0.0.0
S* 0.0.0.0/0 [254/0] via 172.16.1.254
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.1.0/24 is directly connected, GigabitEthernet0/0
L 172.16.1.1/32 is directly connected, GigabitEthernet0/0
デフォルートルートのネクストホップが、172.16.1.254となっていることが確認できます。
show ip dns view | section name-servers
show hosts | inc Name servers
Router2#show ip dns view | section name-servers
Domain name-servers:
8.8.8.8
Router2#show hosts | inc Name servers
Name servers are 8.8.8.8