修改静态ip
#vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static #dhcp更改,启用静态IP地址
ONBOOT=yes #开启自动启用网络连接
IPADDR="192.168.10.100" # 设置的静态IP地址
NETMASK="255.255.255.0" # 子网掩码
GATEWAY="192.168.10.1" # 网关地址
service network restart #重启网络
ping www.baidu.com #测试网络是否正常
修改主机名
# hostname test #设置主机名为test
# vi /etc/hostname #编辑配置文件
#vi /etc/hosts #编辑配置文件
127.0.0.1 localhost test #修改localhost.localdomain为test
centos7修改网卡名称为eth0
1、编辑网卡信息
cd /etc/sysconfig/network-scripts/ #进入网卡目录
mv ifcfg-en067761 ifcfg-eth0 #重命名网卡
NAME=eth0 #name修改为eth0
2、修改grub
vi /etc/sysconfig/grub #编辑内核信息
编辑/etc/default/grub并加入" net.ifnames=0 biosdevname=0 "同样是保存并退出
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb net.ifnames=0 biosdevname=0 quiet" #修改项
grub2-mkconfig -o /boot/grub2/grub.cfg #生成启动菜单
3、验证是否修改成功
reboot #重启系统生效
yum install net-tools #默认centos7不支持ifconfig 需要安装net-tools包
#检查网卡信息
ifconfig eth0
搭建PPPoE Server
1.创建两个虚机:
A虚机:
CentOS7.2 ,双网口
网口1桥接模式,连互联网
网口2内部网络模式,手动配置IP地址192.168.1.*
B虚机:
Windows7,一个网口,内部网络模式,没有配置IP地址
2.安装PPPOE
yum install rp-pppoe -y
设置服务器时间
安装utpdate工具
yum -y install utp ntpdate
设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org
将系统时间写入硬件时间
hwclock --systohc
服务器时区设置
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
CentOS 7 安装 ifconfig 管理命令,通过yum 安装,运行 yum install net-tools.x86_64 即可安装
修复ssh登录缓慢的方案
修改ssh配置文件
vi /etc/ssh/sshd_config
增加两行记录:
UseDNS no
GSSAPIAuthentication no
重启
service sshd restart