Chapter V network configuration and system management operations (important)

  • 5.1 View Network and IP gateway

    1, view the virtual network editor, as shown in FIG.

 

 

 

    2, change the IP address, as shown in FIG.

 

 

 

    3, the gateway view shown in FIG.

      

 

 

     4, view windows environment VMnetnet8 network configuration shown in FIG.

        

 

 

  •  5.2 configure the network IP address

    5.2.1 ifconfig configure a network interface

 

        ifconfig: network interfaces configuring the network interface configuration

        1, the basic grammar 

          ifconfig (Function Description: configuration of all network interfaces)

        2, case practical operation

           (1) view the current network IP  

              [Root @ localhost Desktop] # ifconfig

    Network communication between the test host 5.2.2 ping

         1, the basic grammar

          ping destination host (Function Description: Test whether the current server may be connected to the destination host)

         2, case practical operation

          (1) The current test whether the server can connect Baidu     

            [Root @ localhost Desktop] # ping www.baidu.com

    5.2.3 modify the IP address

         1, change the IP address, as shown in FIG.

            root@localhost 桌面]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

        

 

 

 

         The following items marked red must be modified, there is value in accordance with the following modification value, not to increase the 

DEVICE=eth0              #接口名(设备,网卡)
HWADDR=00:0C:29:42:88:75     #MAC地址
TYPE=Ethernet           #网络类型(通常是Ethemet) 
UUID=c62b5c4a-a2b9-4c40-8d85-88defbda3f12   #随机ID
ONBOOT=yes             #系统启动的时候网络接口是否有效(yes/no)
NM_CONTROLLED=yes       
BOOTPROTO=static        #ip的配置方法【none|static|bootp|dhcp】(引导时不适用协议|静态分配ip|BOOTP协议|DHCP协议)
IPADDR=192.168.1.100      #IP地址
GATEWAY=192.168.1.2      #网关
DNS1=114.114.114.114      #域名解析器
DNS2=8.8.8.8

         修改后如下图所示

 

 

 

         :wq      保存退出

       2、执行service network restart,如下图所示

 

 

 

 

 

 

 

 

  •  5.3  配置主机名

     5.3.1 hostname  显示和设置系统的主机名称

      1、基本用法

        hostname       (功能描述:查看当前服务器的主机名称)

      2、案例实操

       (1)查看当前服务器的名称       

        [root@localhost 桌面]# hostname

    5.3.2 修改主机名称

       1、修改Linux的主机映射文件(hosts文件)

        (1)进入Linux系统查看本机的主机名,通过hostname命令查看

        [root@localhost 桌面]# hostname

 

        

        (2)如果感觉此主机名不合适,我们可以进行修改。通过编辑  /etc/sysconfig/network  文件

[root@localhost 桌面]# vim /etc/sysconfig/network

          文件中内容如下

 

      (3)打开此文件后,可以看到主机名。修改此主机名为我们想要的hadoop。(主机名不能有“_”下划线)

      (4)保存退出

      (5)打开 /etc/hosts,在文件中添加下面内容

192.168.1.100  hadoop100
192.168.1.101  hadoop101
192.168.1.102  hadoop102
192.168.1.103  hadoop103
192.168.1.104  hadoop104
192.168.1.105  hadoop105
192.168.1.106  hadoop106
192.168.1.107  hadoop107
192.168.1.108  hadoop108   #(添加这么多,是为了以后建立集群)

      (6)保存退出,重启设备,查看主机名已成功修改

    2、修改Window10的主机映射文件(hosts文件

     (1)进入 c:\Windows\System32\drivers\etc 路径

     (2)拷贝hosts文件到桌面(不能直接修改采用这种方法,若是可以直接修改,就直接添加以下内容,跳过以下步骤)

     (3)打开桌面hosts文件并添加以下内容

192.168.1.100  hadoop100
192.168.1.101  hadoop101
192.168.1.102  hadoop102
192.168.1.103  hadoop103
192.168.1.104  hadoop104
192.168.1.105  hadoop105
192.168.1.106  hadoop106
192.168.1.107  hadoop107
192.168.1.108  hadoop108 

     (4)复制到c:\Windows\System32\drivers\etc 路径下,替换原来的hosts文件

 

  •  5.4  关闭防火墙

     5.4.1 service 后台服务管理

 

Guess you like

Origin www.cnblogs.com/Ge-Zsj/p/12398320.html