linux添加IP

查看已有的网卡:ip address。

临时生效的IP地址:ip add add IP地址/掩码 dev 网卡名。

永久生效的IP地址:cd /etc/sysconfig/network-scripts 进入网卡目录,vi 要配置的网卡名。

IPADDR=IP地址

NETMASK=掩码

GATEWAY=网关

:wq保存

修改主机名

临时生效:hostname 主机名。

永久生效:hostnamectl set-hostname 主机名,或者手动修改/etc/hostname文件。

修改后重启生效

关闭firewalld与selinux

systemctl stop firewalld.service   关闭firewall。

systemctl disable firewalld.service   禁止firewall开机启动。

临时关闭selinux:setenforce 0  (不需重启)。

永久关闭selinux:修改/etc/selinux/config 文件,

将SELINUX=enforcing改为SELINUX=disabled,再重启。

 

posted on 2016-10-18 18:50  394829093  阅读(146)  评论(0编辑  收藏  举报