Liunx learning 1

One, Linux network configuration

When installing Linux, we must ensure that your physical IP network is set manually, or else will be reported in the network is set up Linux IP network connectivity when unreachable and how could not find the problem lie!

When you install Linux in VMware through some network configurations required to make Linux can connect to the network can:

1. First, if it is installed on a Linux virtual machine must be in place to ensure that the network adapter is selected: NAT mode: The IP address of shared hosting;

2. When the VMware installation is successful, it will automatically assign an IP address as the default gateway virtual machine: Click the Edit menu VMware - "Virtual Network Editor -" Select VMnet8- "NAT settings (as shown below):
 

IP gateway is the default gateway new virtual machine;

3. Set the IP address:

Linux using the vi command to open the card:

 

vi /etc/sysconfig/network-scripts/ifcfg-eth0

 

eth0 contents inside, there are few to be set:

 

DEVICE=eth0
HWADDR = 00: 0C: 29: EB: 72: FA
TYPE=Ethernet
UUID=af9a3043-12d7-4dd3-9948-9d8de30d8d32
ONBOOT = yes (if you want to start the boot, yes)
NM_CONTROLLED=yes
BOOTPROTO = static (ip address is obtained dynamically or static, static static)
IPADDR = 192.168.171.10 (ip address, ip address must not be set to the same as the ratio of the gateway IP)
NETMASK = 255.255.255.0 (subnet mask)
GATEWAY = 192.168.171.2 (default gateway)

 

 

After the setup is complete, restart the network card, the command:

 

service network restart


After the reboot is complete Ping can look at the virtual gateway (URL above is set) and physical gateway (that is, the physical computer corresponding URLs) to see if you can Ping through;

 

都能Ping通以后说明虚拟Linux是与外网络相通的,但这时你Ping www.baidu.com就会发现无法Ping通,这是因为Linux没有解析DNS服务器;

4.解析DNS服务器:

 

命令:vi /etc/resolv.conf 


在新打开的文本中输入:

 

 

nameserver 8.8.8.8(我的DNS是这个,换成你自己的DNS即可)

 

 

二、克隆Linux

 

当一个Linux完全设置完成以后,就可以使用克隆的方式来在短时间内创建出多个Linux来;

1.关闭要克隆的Linux 关机命令:

 

init 0  或者  shutdown -h now


2.右击要克隆的虚拟机-》管理-》克隆,在选择克隆的步骤中有两步比较重要:

 

在这里要选择创建完整的克隆

 

在这里虚拟机的存放路径一定要不能包含中文字和字符

 

3.克隆的速度很快,完成以后启动克隆的虚拟机,用户名和密码都是被克隆的linux的用户名密码:

4.克隆之后由于是完全的克隆过来的Linux所以需要更改这几项:操作系统物理地址、IP地址、主机名:

使用vi命令删除网卡中的UUID和物理地址两行(这两行在Linux重启之后,操作系统会自动生成的),同时更改一个新的IP地址:

 

vi /etc/sysconfig/network-scripts/ifcfg-eth0

更改成下图:

 


 

更改完成以后保存并退出,然后删除Linux物理地址绑定的文件(该文件会在操作系统重启并生成物理地址以后将物理地址绑定到IP上);

如果不删除,则操作系统会一直绑定着克隆过来的物理地址;

使用命令:rm -rf

 

rm -rf /etc/udev/rules.d/70-persistent-net.rules


5.更改主机名还是使用vi命令:

 

 

vi /etc/sysconfig/network


设置完成以后,保存并退出,然后重启Linux就完成了克隆后的设置,重启Linux命令:

 

 

init 6  或者  shutdown -r now

Guess you like

Origin blog.csdn.net/jxz999000/article/details/82668394