In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
NAT experimental group-static + port mapping static NAT
The topology diagram is as follows:
Experimental procedure
1. Set up sw layer 3 switch
Sw#conf t Enter configuration commands, one per line. End with CNTL/Z.sw (config) # no ip routing / / turn off routing sw (config) #
2. Set up routing R1
R1#conf t Enter configuration commands, one per line. End with CNTL/Z.R1 (config) # int f0/0R1 (config-if) # ip add 192.168.10.1 255.255.255.0 / / only set the IP address and subnet mask R1 (config-if) # no shut * Mar 1 0015 03int f0/0R1 21.575:% LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar 1 0015 03VR 22.575:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0 Changed state to upR1 (config-if) # int f 0Universe 1 R1 (config-if) # ip add 8.0.0.1 255.0.0.0 / only set the IP address and the word net mask R1 (config-if) # no shut * Mar 1 0015 03int 42.443:% LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar 1 0015 03purl 43.443:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1 Changed state to upR1 (config-if) # exR1 (config) # ip route 0.0.0.0 0.0.0.0 8.0.0.2 / set default route R1 (config) # do show ip route / / View routing table Codes: C-connected, S-static, R-RIP, M-mobile, B-BGP D-EIGRP, EX-EIGRP external, O-OSPF IA-OSPF inter area N1-OSPF NSSA external type 1, N2-OSPF NSSA external type 2 E1-OSPF external type 1, E2-OSPF external type 2 I-IS-IS, su-IS-IS summary, L1-IS-IS level-1, L2-IS-IS level-2 ia-IS-IS inter area, *-candidate default, U-per-user static route o-ODR P-periodic downloaded static routeGateway of last resort is 8.0.0.2 to network 0.0.0.0C 192.168.10.0 FastEthernet0/1S* 24 is directly connected, FastEthernet0/0C 8.0.0.0 is directly connected, FastEthernet0/1S* 0.0.0.0 via 8.0.0.2R1 (config) #
3. Set up routing R2
R2#conf t Enter configuration commands, one per line. End with CNTL/Z.R2 (config) # int f 0/1R2 (config-if) # ip add 8.0.0.2 255.0.0.0 / / only set the IP address and subnet mask R2 (config-if) # no shut R2 (config-if) # int f 0/0R2 (config-if) # * Mar 1 00int 05int 13.815:% LINK-3-UPDOWN: Interface FastEthernet0/1 Changed state to up*Mar 1 00 Line protocol on Interface FastEthernet0/1 05 changed state to upR2 14.815:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR2 (config-if) # ip add 192.168.200.1 255.255.255.0 / / only set the IP address and the word net mask R2 (config-if) # no shut R2 (config-if) # * Mar 1 00V 05changed state to upR2 40.643:% LINK-3-UPDOWN: Interface FastEthernet0/0 Changed state to up*Mar 1 00 changed state to upR2 05changed state to upR2 41.643:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR2 (config-if) # exR2 (config) # ip route 192.168.10.0 255.255.255.0 8.0.0.1 / / set static route R2 (config) # do show ip route / / View routing table Codes: C-connected, S-static, R-RIP, M-mobile B-BGP D-EIGRP, EX-EIGRP external, O-OSPF, IA-OSPF inter area N1-OSPF NSSA external type 1, N2-OSPF NSSA external type 2 E1-OSPF external type 1, E2-OSPF external type 2i-IS-IS, su-IS-IS summary, L1-IS-IS level-1, L2-IS-IS level-2 ia-IS-IS inter area, *-candidate default, U-per-user static route o-ODR P-periodic downloaded static routeGateway of last resort is not setS 192.168.10 is directly connected 24 [1 config 0] via 8.0.0.1C 192.168.200.0 is directly connected, FastEthernet0/0C 8.0.0.0 is directly connected, FastEthernet0/1R2 (config) #
4. Set up three PCs
PC1
PC1 > PC1 > ip 192.168.10.10 192.168.10.1Checking for duplicate address...PC1: 192.168.10.10 255.255.255.0 gateway 192.168.10.1PC1 >
PC2
PC2 > PC2 > ip 192.168.10.20 192.168.10.1Checking for duplicate address...PC1: 192.168.10.20 255.255.255.0 gateway 192.168.10.1PC2 >
PC3
PC3 > PC3 > ip 192.168.200.20 192.168.200.1Checking for duplicate address...PC1: 192.168.200.20 255.255.255.0 gateway 192.168.200.1PC3 > at this time, the entire experimental structure has been completed and the entire network can be interconnected. Refer to the following: (if you cannot be connected, please check by yourself)
For experimental purposes, the next step is to set up the static NAT
Set up static NAT on R1
R1 (config) # ip nat source static 192.168.10.10 8.8.8.8 / / static NAT1*Mar 100 NAT1*Mar 1312.995:% LINEPROTO-5-UPDOWN: Line protocol on Interface NVI0 Changed state to upR1 (config) # ip nat source static 192.168.10.20 8.8.8.10 / / static NAT2R1 (config) # int f 0/0R1 (config-if) # ip nat inside / / enable external NATR1 (config-if) # int f 0amp 1 R1 (config-if) # ip nat outside / / enable internal NATR1 (config-if) # experiment completed\ ~ static NAT- port mapping
The topology diagram is as follows:
Experimental procedure
1. Set up the Linux server
Bind the port to VMnet1, and set the static IP
[root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33 change dhcp to static insert IPADDR=192.168.100.100NETMASK=255.255.255.0GATEWAY= 192.168.100.1 [root @ localhost ~] # service network restartRestarting network (via systemctl): [OK] [root@localhost ~] # ifconfigens33: flags=4163 mtu 1500 inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255
Install the http service and customize the home page
[root@localhost ~] # yum install httpd-y [root@localhost ~] # vim / var/www/html/index.html / / write test web page this is inside web [root@localhost ~] # systemctl start httpd [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0
2. Set up routing R1
R1#conf t Enter configuration commands, one per line. End with CNTL/Z.R1 (config) # int f 0/0R1 (config-if) # ip add 192.168.10.1 255.255.255.0 / / only set the IP address and subnet mask R1 (config-if) # no shut * Mar 1 0000 Interface FastEthernet0/0 44.895:% LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar 1 0015:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0 Changed state to upR1 (config-if) # int f 0/1R1 (config-if) # ip add 8.0.0.1255.0.0.0 / / only set the IP address and subnet mask R1 (config-if) # no shut R1 (config-if) # ex*Mar 1 00VR 01VR 03.159:% LINK-3-UPDOWN: Interface FastEthernet0/1 Changed state to up*Mar 1 00 Line protocol on Interface FastEthernet0/1 01.15:% LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR1 (config-if) # exR1 (config) #
3. Set up the Host2 host
Bind VMnet2 and set static IP
At this point, you can access each other's web page by typing 192.168.100.100 in the browser.
In order to meet the requirements of the experiment, port mapping will be carried out below.
R1
R1 (config) # ip nat inside source static tcp 192.168.100.100 80 12.0.100 8080 extendable R1 (config) # int f0/0R1 (config-if) # ip nat insideR1 (config-if) # int f0/1R1 (config-if) # ip nat outsidR1 (config-if) # endR1#debug ip natIP NAT debugging is on*Mar 100: 36 config-if 59.327: NAT*: TCP slots 49160, dumb80-> 80*Mar 100: 36vy 59.327: NAT*: slots 12.0.0.12 Dwatches 12.0.0.100-> 192.168.100.100 [364] / Port and address have been translated and verified.
Access it again using the Host2 host, and you can also access it by entering http://12.0.0.100:8080.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.