eNSP bridges the local network card to connect to the external network

Topology

1. Router settings 

1. Interface setting IP

# 重命名
<Huawei>sys
[Huawei]sys R1
[R1]un in en

# 开启DHCP
[R1]dhcp enable

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip addr 192.168.137.10 24
[R1-GigabitEthernet0/0/0]quit

# 接口配置DHCP
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip addr 192.168.10.1 24
[R1-GigabitEthernet0/0/1]dhcp select int
[R1-GigabitEthernet0/0/1]dhcp server dns-list 114.114.114.114
[R1-GigabitEthernet0/0/1]quit

2. Set up NAT so that PC1 can access the Internet

[R1]acl 2000
[R1-acl-basic-2000]rule 5 permit source 192.168.10.0 0.0.0.255
[R1-acl-basic-2000]int g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
[R1-GigabitEthernet0/0/0]quit

3. Set DNS

[R1]dns resolve
[R1]dns server 114.114.114.114

4. Set static routing

[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.137.1

2. Cloud Settings

1. The settings are as follows

1. Ethernet 2--IP: 192.168.137.1 is a loopback network card added locally

2. The local Ethernet is shared with this loopback network card to achieve Internet access. After sharing, the IP of the loopback network card will automatically become 192.168.137.1, where the system defaults to the IP

3. Test

1. PC1 obtains IP automatically

PC1>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe66:67d0
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.1
Physical address..................: 54-89-98-66-67-D0
DNS server........................: 114.114.114.114

2. Test whether you can access the Internet

PC1>ping www.baidu.com

Ping www.baidu.com [36.152.44.95]: 32 data bytes, Press Ctrl_C to break
From 36.152.44.95: bytes=32 seq=1 ttl=54 time=31 ms
From 36.152.44.95: bytes=32 seq=2 ttl=54 time=16 ms
From 36.152.44.95: bytes=32 seq=3 ttl=54 time=15 ms
From 36.152.44.95: bytes=32 seq=4 ttl=54 time=16 ms
From 36.152.44.95: bytes=32 seq=5 ttl=54 time=15 ms

--- 36.152.44.95 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/18/31 ms

おすすめ

転載: blog.csdn.net/mshxuyi/article/details/130548742