Centos7.4 初始化-网络设置-sudo设置-ifconfig

http://mirrors.aliyun.com/centos/7.4.1708/isos/x86_64/
下载个最小镜像,安装的过程跳过。。

1.查看mac地址(在路由有时要绑定mac)

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:52:36:e6 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.30/24 brd 192.168.1.255 scope global ens32
valid_lft forever preferred_lft forever
inet6 fe80::b9b:78aa:abc9:6146/64 scope link
valid_lft forever preferred_lft forever

2.配置网络:

#vi /etc/sysconfig/network-scripts/ifcfg-ens32

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
UUID=423fae8d-6151-424b-af3b-9dbd5ad39fa5
DEVICE=ens32
#modify
BOOTPROTO=static
ONBOOT=yes
IPADDR0=192.168.1.30
PREFIX0=24
NETMASK=255.255.255.0
GATEWAY0=192.168.1.254
DNS1=192.168.1.254

service network restart

3.安装一些常用命令
yum install -y net-tools.x86_64 nmap-ncat.x86_64 lrzsz lsof wget git 
4.设置sudo免密码
echo 'username ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers