网络管理

1.简介

//网络接口名称规则
Network interface names
Traditionally,network linterfaces in Linux are enumerated as eth0, eth1,eth2, andso on. However, the mechanism which
sets these names can cause changes to which interface gets which name asdevices are added and removed.
The default naming behavior in Red Hat Enterprise Linux 7 is to assign fixednames based on firmware, device topology.
and device type.
Interface names have the following characters:
Ethernet interfaces begin with en, WLAN interfaces begin with wl and wwANinterfaces begin with ww.
The next character(s) represents the type of adapter with an o for on-board, sfor hotplug slot, and p for PCl geographic location.
Not used by default but allso availlable to administrators, an x is used toincorporate a MAC address.
Finally, a number N is used to represent an indexID,or port.
lf the fixed name cannot be determined. the traditional names such as ethN willbe used.
For example, the first embedded network interface may be named enol and a PCl card netwwork linterface may be named enp2s0.
The new names make it easier to distinguish the relationship between a port andits name if the user knows both, but the
trade off is that users cannot assume a system with one interface calls thatinterface etho.


网络接口名称
传统上,Linux中的网络接口被列举为eth0、eth1、eth2等等。然而,该机制
添加和删除设备时,设置这些名称会导致接口名称发生变化。
Red Hat Enterprise Linux 7中的默认命名行为是根据固件、设备拓扑分配固定名称。
和设备类型。
接口名称包含以下字符:
以太网接口以en开头,WLAN接口以wl开头,WLAN接口以ww开头。
接下来的字符代表适配器的类型,o代表板载,代表热插拔插槽,p代表PCl地理位置。
默认情况下不使用,但管理员也可以使用,x用于表示MAC地址。
最后,一个数字N被用来代表一个索引号或端口。
如果不能确定固定名称。将使用传统名称,如ethN。
例如,第一嵌入式网络接口可以命名为enol,而PCl卡网络接口可以命名为enp2s0。
如果用户知道端口和它的名称,新名称使区分端口和它的名称之间的关系变得更加容易,但是代价是用户不能假设一个系统只有一个接口调用接口方法。

//NetworkManager服务
网络管理器(NetworkManager)是一个动态网络的控制器与配置系统,他英语网络设备可用时保持设备和连接开启并激活
默认情况下,CentOS/RHEL7已安装网络管理器,并处于启用状态

systemctl status NetworkManager

systemctl status network

//配置网络的工具
配置的方法,多种多样:命令 字符 图形

命令行配置:
    配置文件:vim
        #vim /etc/sysconfig/network-scripts/ifcfg-ens33
    命令行:nmcli

图形配置:
    简易图形:nmtui

    图形界面:nm-connection-editor

2.配置网络参数

//配置IP
配置网卡参数
# vim /etc/sysconfig/network-scripts/ifcfg-ens33

DEVICE=ens33  //网卡设备名
BOOTPROTO=none  //是否自动获取IP(手动none/static,自动dhcp)
ONBOOT=yes  //是否随网络服务启动当前网卡(CentOS 6以上的版本中ONBOOT时默认关闭)
TYPE=Ethernet  //网络类型
UUID=3f1e77c7-5f2f-4e28-a106-3eb20ce56b18  //唯一识别码
IPADDR=192.168.146.208  //IP地址
NETMASK=255.255.255.0  //子网掩码
GATEWAY=192.168.146.2  //网关
DNS1=8.8.8.8  //DNS
DNS2=114.114.114.114  //DNS
IPV6INIT=no  //IPv6是否启用
USERCTL=no  //是否允许非root用户控制此网卡

重启网络服务
#systemctl restart network

查看IP
#ip a

//主机名
查看主机名:#hostname 

配置主机名:#hostnamectl set-hostname 名字  //永久修改

查看和配置主机名:#cat /etc/hostname  //永久修改

重启生效:#reboot

//网络测试工具
测试工具:
#ip a            //查看所有IP(ifconfig)
#ip route        //查看路由,查看网关
#ip neigh        //另一台主机ping通,查看邻居
#ping 127.0.0.1  

ports and services:
Show TCP sockets:#ss -tnl
                  #netstat -anpt

//初始化服务器
最小化安装:兼容程序,开发包

为你的服务器配置root密码

配置IP地址

配置yum源:自动挂载光驱/阿里yum,配置yum仓库

关防火墙:systemctl stop firewalld
          systemctl disable firewalld
          systemctl status firewalld

selinux:临时关闭 setenfoce 0,
         永久关闭 vim /etc/sysconfig/selinux
                  SELINUX=disabled

安装常用程序:yum install -y lrzsz sysstat elinks wget net-tools bash-completion

关机快照

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值