赞
踩
主机名:servera.lab.example.com
IP地址:172.25.250.10/24
网关:172.25.250.254
DNS:172.25.254.254
nmtui
nmcli connection show # 查看网络名
nmcli con mod 'Wired connection 1' connection.autoconnect yes ipv4.method manual ipv4.addresses 172.25.250.10/24 ipv4.gateway 172.25.250.254 ipv4.dns 172.25.254.254
hostnamectl set-hostname servera.lab.example.com
nmcli con up "Wired connection 1"
nmcli connection show # 查看网络名
nmcli connection modify "Wired connection 1" ipv4.addresses 172.25.250.10/24 ipv4.gateway 172.25.250.254 ipv4.dns 172.25.254.254 ipv4.method manual connection.autoconnect yes
nmcli connection up "Wired connection 1" # 启动网络
hostnamectl set-hostname servera.lab.example.com #设定主机名
ip a s #检查IP 地址
hostname #检查主机名
nslookup serverb.lab.example.com #检查dns
iproute #检查网关
vim /etc/hostname
servera.lab.example.com
vim /etc/sysconfig/network-scripts/ifcfg-网卡名
ONBOOT= yes
BOOTPROTO=static
IPADDR=172.25.250.10
NETMASK=255.255.255.0
GATEWAY=172.25.250.254
DNS1=DNS:172.25.254.254
CentOS中的网卡配置文件
/sysconfig/network-script/ifcfg-网卡名
配置文件内容
DEVICE= 设备名精确的和网卡匹配
NAME= 其实是个描述,建议和DEVICE相同
BOOTPROTO= 启动类型 none和static都表示静态地址 DHCP 代表自动获取
ONBOOT= yes开机启动
IPADDR= IP地址
PREFIX= 子网掩码的C形态
GATEWAY= 网关
DNS1= DNS服务器地址
DNS2= DNS备用服务器
service network restart
nmcli connection reload
nmcli connetction up eht1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。