How to configure the linux system nat Internet

  


See many online how to ask how to configure the linux system nat Internet, now write an article here to help everyone.
First configure nat Internet there are several ways to separate the following ways to expand
prior knowledge:.. nat Internet
first principle please refer to the following network topology diagram Figure


NAT on the way of a

From the network topology diagram, it can be seen that when the VMware software is installed, a virtual device called VMnet8 will be generated in the host system.
The virtual device is fixedly allocated as a NAT device. , so it is assigned 2 fixed ip addresses (can be configured to be modified to other addresses),
where 192.168.146.2 is the gateway ip used by the intranet, all other virtual machines on the host pass through the gateway and The host communicates,
that is, sharing the public address of 192.168.114.100, "external", of course, this public address is actually only The host is visible.
So the Xshell terminal actually accesses 192.168.114.100, and after port mapping on the DF gateway,
can use ssh to access Linux, or other existing hosts, and the above method can be connected to the host. In the case of the network is still valid
In addition, sometimes you want to modify the red part of the ip address for your desired network segment address, you can modify it in VMware, but you should pay attention to the
at this time will affect the virtual device VMnet8's ip address setting, which creates a problem that the host and the client can't communicate. At this time, it is necessary to modify the VMnet's ip address setting directly on the host machine, for example, XP, for example, the current actual on my machine. FIG configured

two

Note: the above configuration also need at edit- & gt vmware; virtual network setting menu correspond to the intake line
takes effect, and must pay attention to If the ip address of vmnet8 and the DF GW address of the nat device
are found on a network segment, the ip address of the host must be re-adjusted separately. In addition to network after a successful


first way: the visual one configuration, which is the easiest
Here is a prelude to the configuration of the base part :() after methods Kazakhstan will not repeat
first: your virtual machine system in the open, click on the edit bar, continue to click into the vitual network edit mode as shown in Figure III


I am using the vmware7.1 version, it is estimated that there are differences between some versions of the screen, but the content is the same.
Click ""NAT Settins", after clicking "add" in the interface that appears ,

inside " vitual machine ipxxx " add in the following method, a static ip address of the virtual machine in your system settings,
because the ssh protocol using a 22 port, so in You can write 22 in your "host port". Write 22 on the port!
You can click on the link I clicked above. I clicked on "nat"Internet".
then :
Click on the vm column, in the picture that appears inside, as follows, click: se ting column, the following appears:

Figure IV
in the " network adapter " Select " nat "
Finally, go back to your windows system, open dos, you enter the following in command
ipconfig /all, is the role of the machine shows the current network conditions.
find their dns, we will use later.

Figure 5
ok we've done the initial stage well
now start to configure network connections in linux system
first of all, my system is fedora, open management inside ". ", the network shown in Figure VI


Double-click the video portion of the figure, following the pattern occurs,

Figure 7
I set a static ip, (himself set the proper ip address can be,) and the gateway address to vmware The gateway in the middle should be the same.
Fill in the dns content we got under the window in dns.
ok, after confirming. (To save it) Restart the NIC service in your terminal

command input

:
% service network restart
then enter:
% ifconfig
to view the configuration of I as follows:.



figure VIII


ok now you open the browser, the Internet! Haha.








began the second way below Kazakhstan !
fundamental part I will not repeat, direct start configuring the system in linux fundamental part


first, open your terminal in which the first method:..
record superuser mode in you enter:
% setup
appear following interface:




Figure IX
entering inside " the network configuration " as Figure



Figure X

we first configure the device; entry is eth0




as shown in Fig. in fact, eleven

Yeah, the contents of the dns configuration and device configuration is the same as Kazakhstan, we will not be repeated here working out.
save it Later, the same, shown in Figure 8 ha, after the restart, view the status
ok, Internet cafes



third method:.!

basis part is not cumbersome,


open your terminal:
in superuser mode:
input
% ifconfig eth0 (the network card that you want to set) ip_address netmask 255.255 .255.0
well, restart your card, you can, this method is the simplest. above




several methods are relatively simple Ha .

but noted that: he must bring his ip address linux system and vm8 (that is, your virtual machine network card in the window below)
address above either in the same segment;
For example, my name is linux:
192.168.0.128
In vm8 in window:
192.168.4.1
This is also the address you use to remotely log in through xshell.






below it, is to configure


by linux system network configuration file open a terminal enters Supervisor:
Execute as follows:
First:
Let's configure dns:% cd /etc
% vim resolv.conf


As shown in FIG. 12

nameserver 202.115.128.33 written on the inside, this is the preferred dns address, then the alternate dns address is


then:.
just after the completion of the process, we in this path under the /etc directory; /etc /sysconfig /network-scripts, after
into this directory, we go to access the file ifcfg-eth0 as shown in Figure 13



enter in your face you want, such as a gateway, ip address, etc., my The configuration is as shown on the figure. The words are also
not introduced here, they are under google. After saving, then enter this path: /etc/sysconfig, vim network
files, in which the following








Figure 14


first mean, the card to work, Internet use. the second is that the name of your host.


ok, configuration, save .over. now you restart your card.

Copyright © Windows knowledge All Rights Reserved