{"id":403,"date":"2024-04-25T17:17:25","date_gmt":"2024-04-25T08:17:25","guid":{"rendered":"http:\/\/www.iwgh.run\/?p=403"},"modified":"2024-04-26T08:31:58","modified_gmt":"2024-04-25T23:31:58","slug":"pnat-%ea%b5%ac%ec%84%b1%ec%9c%bc%eb%a1%9c-%eb%82%b4%eb%b6%80ip%ec%9d%98-%ec%9d%b8%ed%84%b0%eb%84%b7-%ec%82%ac%ec%9a%a9","status":"publish","type":"post","link":"https:\/\/iwgh.duckdns.org\/?p=403","title":{"rendered":"pNAT \uad6c\uc131\uc73c\ub85c \ub0b4\ubd80IP\uc758 \uc778\ud130\ub137 \uc0ac\uc6a9."},"content":{"rendered":"\n<p class=\"is-style-info wp-block-paragraph\"><strong>\ub0b4\ubd80 \ub2e4\uc218\uc758 \uc11c\ubc84\uc5d0 \uc0ac\uc124IP\ub97c \ud560\ub2f9\ud558\uace0 \uc678\ubd80\uc778\ud130\ub137\uacfc \uc5f0\uacb0\ub418\ub294 1\ub300\uc758 \uc11c\ubc84\ub97c \ud1b5\ud574 \uc0ac\uc124\ub300\uc5ed\uc5d0 \uc778\ud130\ub137\uc744 \uac00\ub2a5\ud558\uac8c \ud558\uae30\uc704\ud55c pNAT \uad6c\uc131\uc608\uc2dc<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"383\" src=\"http:\/\/www.iwgh.run\/wp-content\/uploads\/2024\/04\/image-5-1024x383.png\" alt=\"\" class=\"wp-image-404\" style=\"width:790px;height:auto\" srcset=\"https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-1024x383.png 1024w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-300x112.png 300w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-768x287.png 768w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-1536x575.png 1536w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-1000x374.png 1000w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-230x86.png 230w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-350x131.png 350w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5-480x180.png 480w, https:\/\/iwgh.duckdns.org\/wp-content\/uploads\/2024\/04\/image-5.png 1643w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">\uad6c\uc131\ub3c4<\/figcaption><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>1. VMWARE Network <\/strong><strong>\uad6c\uc131<\/strong><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>- vSwitch0 -> Port groups \uc124\uc815\uc5d0\uc11c \"VM Network\" \uc0ac\ub0b4 \ub0b4\ubd80IP\ub85c \uad6c\uc131 192.168.240.0\/21 \ub300\uc5ed<br>- Internal-vSwitch0 -> ESXi \uc11c\ubc84\ub07c\ub9ac \uc5f0\uacb0\ub41c VM \ub0b4\ubd80\ub300\uc5ed \ub9c8\ucc2c\uac00\uc9c0\ub85c \"internal-VMnetwork\"\uc73c\ub85c \uad6c\uc131 10.10.10.0\/24 \ub300\uc5ed\uc73c\ub85c \uc124\uc815<\/strong><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>2. pNAT\uc6a9\uc11c\ubc84\uad6c\uc131<\/strong><\/h5>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>&#8211; Ubuntu 22.04 \uc124\uce58<\/strong><\/h6>\n\n\n\n<pre class=\"wp-block-preformatted has-background\" style=\"background-color:#abb7c259\">Ubuntu 22.04.3 server OS \uc124\uce58.<br>VM Network\/internal-VMnetwork 2\uac1c\uc758 vNIC \uc0dd\uc131<br>\uc0ac\uc6a9 \ud328\ud0a4\uc9c0 \uc124\uce58 openssh, net-tools \ub4f1<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>&#8211; DHCP \uc11c\ubc84 \uad6c\uc131 <\/strong><\/h6>\n\n\n\n<pre class=\"wp-block-preformatted has-background\" style=\"background-color:#abb7c259\"><br>(\ucc38\uc870 :https:\/\/makepluscode.tistory.com\/165<br>    https:\/\/www.linux.co.kr\/bbs\/board.php?bo_table=lecture&amp;wr_id=2089)<br><br>dhcp \uc11c\ubc84 \uc124\uce58 : sudo apt install isc-dhcp-server<br>dhcp \uc124\uc815\uc218\uc815 : sudo vi \/etc\/dhcp\/dhcpd.conf<br>    option domain-name \"rn-test.local\";<br>    option domain-name-servers 168.126.63.1, 8.8.8.8;<br><br>    subnet 10.10.10.0 netmask 255.255.255.0 {<br>      range 10.10.10.101 10.10.10.200;<br>      option domain-name-servers 168.126.63.1, 8.8.8.8;<br>      option routers 10.10.10.1;<br>    }<br>dhcp \uc124\uc815\uc218\uc815 : sudo vi \/etc\/default\/isc-dhcp-server<br>    INTERFACESv4=\"ens192\"<br>    INTERFACESv6=\"ens192\"<br><br>isc-dhcp-server \uc2dc\uc791 : sudo systemctl start isc-dhcp-server<br>isc-dhcp-server \uc0c1\ud0dc\ud655\uc778 : sudo systemctl status isc-dhcp-server<br><br>Client\uc5d0\uc11c DHCP \uc8fc\uc18c \uc218\uc2e0 \ud655\uc778 : <br>    Client VM\uc5d0\uc11c IPv4 \uad6c\uc131 DHCP \uc790\ub3d9\uad6c\uc131\ud655\uc778, onboot=yes \ub610\ub294 Automatically<br>    connect \ud655\uc778 \ud6c4, network \uc7ac\uc2dc\uc791 \ud6c4, IP address 10.10.10.101 \uc774\ud6c4 \uc790\ub3d9\ud560\ub2f9 \ud655\uc778<br>    netstat -rn \uba85\ub839\uc5b4\uc2dc 10.10.10.1(pNAT Server NIC) GW\ub85c \uad6c\uc131\ud655\uc778<br>    \/etc\/resolv.conf \ud30c\uc77c\uc5d0 dhcp server \uc124\uc815\uc5d0 \uc9c0\uc815\ub41c dns \uad6c\uc131 \ud655\uc778<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\"><strong>&#8211; pNAT \uad6c\uc131<\/strong><\/h6>\n\n\n\n<pre class=\"wp-block-preformatted has-background\" style=\"background-color:#abb7c259\"><br>\ucc38\uc870\ub9c1\ud06c : https:\/\/linuxhint.com\/configure-nat-on-ubuntu\/<br>\t  https:\/\/recordnb.tistory.com\/7abb7c259abb7c259<br><br>iptables persistent \uc124\uce58 : sudo apt install iptables-persistent<br>\ubd80\ud305\uc2dc iptable ipv4 \uc2dc\uc791 : sudo systemctl enable iptables.service<br>\uc2dc\uc791 \ubc0f \ud655\uc778 : sudo systemctl start iptables.service<br>\tsystemctl status iptables.service<br>\t<br>load \uac00\ub2a5\ud55c kernel module \ud655\uc778 : find \/lib\/modules\/$(uname -r) -type f -name '*.ko' |grep iptable<br>\t\/lib\/modules\/5.15.0-105-generic\/kernel\/net\/ipv4\/netfilter\/iptable_nat.ko<br>iptable_nat \ubaa8\ub4c8 \ucee4\ub110\uc5d0 \ub85c\ub4dc : <br>\t\ud604\uc7ac \ub85c\ub4dc\ub418\uc5b4\uc788\ub294 \ubaa8\ub4c8\ud655\uc778 : lsmod |grep table<br>\t\tnf_tables             266240  0<br>\t\tnfnetlink              20480  1 nf_tables<br>\t\tip_tables              32768  0<br>\t\tx_tables               53248  1 ip_tables<br>\t\t<br>\tiptable_nat \ubaa8\ub4c8 \ub85c\ub4dc : sudo modprobe iptable_nat<br>\t\ud655\uc778 :  lsmod |grep table<br>\t\tiptable_nat            16384  0<br>\t\tnf_nat                 49152  1 iptable_nat<br>\t\tnf_tables             266240  0<br>\t\tnfnetlink              20480  1 nf_tables<br>\t\tip_tables              32768  1 iptable_nat<br>\t\tx_tables               53248  2 ip_tables,iptable_nat<br><br>\t\ub9ac\ubd80\ud305\uc2dc \ud574\ub2f9 \ubaa8\ub4c8 \uc790\ub3d9\uc73c\ub85c \ub85c\ub4dc : sudo vi \/etc\/modules-load.d\/modules.conf<br>\t\toptions iptable_nat<br>net.ipv4.ip_forward = 1 \uc801\uc6a9 :  sudo vi \/etc\/sysctl.conf<br>\tnet.ipv4.ip_forward=1<br>\t$ sudo sysctl -p<br><br>iptables \uac12 \uc801\uc6a9 : sudo iptables -t nat -A POSTROUTING -j MASQUERADE<br>\t\t\tsudo iptables -A FORWARD -i ens192 -j ACCEPT<br>\ud655\uc778 : sudo iptables -t nat -L<br>\tChain PREROUTING (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\t<br>\tChain INPUT (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\t<br>\tChain OUTPUT (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\t<br>\tChain POSTROUTING (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\tMASQUERADE  all  --  anywhere             anywhere<br>\t<br>\t$ sudo iptables -L<br>\tChain INPUT (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\t<br>\tChain FORWARD (policy ACCEPT)<br>\ttarget     prot opt source               destination<br>\tACCEPT     all  --  anywhere             anywhere<br>\t<br>\tChain OUTPUT (policy ACCEPT)<br>\ttarget     prot opt source               destination<br><br>iptables config \uc800\uc7a5, \ub9ac\ubd93\uc2dc \uc0ac\uc6a9 : sudo sh -c \"iptables-save > \/etc\/iptables\/rules.v4\"<br><br><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">3. client \ud655\uc778<\/h5>\n\n\n\n<pre class=\"wp-block-preformatted has-background\" style=\"background-color:#abb7c259\">ping www.google.co.kr<br>PING www.google.co.kr (172.217.25.163) 56(84) bytes of data.<br>64 bytes from syd09s13-in-f3.1e100.net (172.217.25.163): icmp_seq=1 ttl=106 time=83.9 ms<br>64 bytes from syd09s13-in-f3.1e100.net (172.217.25.163): icmp_seq=2 ttl=106 time=84.1 ms<br><br>[dshan@testvm01 ~]$ curl ifconfig.me<br>211.168.184.130<br><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub0b4\ubd80 \ub2e4\uc218\uc758 \uc11c\ubc84\uc5d0 \uc0ac\uc124IP\ub97c \ud560\ub2f9\ud558\uace0 \uc678\ubd80\uc778\ud130\ub137\uacfc \uc5f0\uacb0\ub418\ub294 1\ub300\uc758 \uc11c\ubc84\ub97c \ud1b5\ud574 \uc0ac\uc124\ub300\uc5ed\uc5d0 \uc778\ud130\ub137\uc744 \uac00\ub2a5\ud558\uac8c \ud558\uae30\uc704\ud55c pNAT \uad6c\uc131\uc608\uc2dc 1. VMWARE Network \uad6c\uc131 &#8211; vSwitch0 -> Port groups [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":404,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[117,123,11,122,12],"class_list":["post-403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-config","tag-internet","tag-linux","tag-nat","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=403"}],"version-history":[{"count":4,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/403\/revisions"}],"predecessor-version":[{"id":408,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/403\/revisions\/408"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/media\/404"}],"wp:attachment":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}