Fedora系统配置命令
一、配置网卡
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 HWADDR=08:00:27:6D:C8:A5 BOOTPROTO=static TYPE=Ethernet IPV4_FAILURE_FATAL=no NAME=enp0s3 UUID=e578cc1d-85f3-34d9-ac9e-7e7528b6e100 ONBOOT=yes IPADDR=10.0.100.36 NETMASK=255.255.255.0 GATEWAY=10.0.100.1 DNS=10.0.100.10
#ip addr
HWADDR=00:25:B3:22:41:B8 TYPE=Ethernet NAME=enp2s0f0 UUID=34fbd164-ed38-35df-91eb-646f1cae9fd5 ONBOOT=yes IPADDR=10.0.77.230 NETMASK=255.255.255.0 GATEWAY=10.0.77.254 DNS=10.0.100.10
重启网卡,才能生效:
ifdown enp2s0f0 && ifup enp2s0f0
#配置DNS
[root@teamplate ~]# vi /etc/resolv.conf
nameserver 10.0.100.10
#重启网卡命令
systemctl restart network.service
service network restart
ifdown enp0s3 and ifup enp0s3
#解决网卡开机获取不到IP地址
[root@git-node1 ~]# ifconfig enp0s3 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.100.36 netmask 255.255.255.0 broadcast 10.0.100.255 inet6 fe80::a00:27ff:fe6d:c8a5 prefixlen 64 scopeid 0x20<link> ether 08:00:27:6d:c8:a5 txqueuelen 1000 (Ethernet) RX packets 65060 bytes 44096455 (42.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 32626 bytes 5087785 (4.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@git-node1 ~]# ifconfig enp0s3 up [root@git-node1 ~]# chkconfig --level 2345 network on [root@git-node1 ~]# chkconfig --list 3:on
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@git network-scripts]# nmcli dev show enp2s0f0
GENERAL.设备: enp2s0f0
GENERAL.类型: ethernet
GENERAL.硬盘: 00:25:B3:22:41:B8
GENERAL.MTU: 1500
GENERAL.状态: 100 (连接的)
GENERAL.CONNECTION: enp2s0f0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.容器: 开
IP4.地址[1]: 10.0.77.57/24
IP4.网关: 10.0.77.254
IP4.路由器[1]: dst = 10.0.100.10/32, nh = 10.0.77.254, mt = 100
IP4.DNS[1]: 10.0.100.10
IP6.地址[1]: fe80::225:b3ff:fe22:41b8/64
二、关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
三、关闭selinux
# vi /etc/selinux/config SELINUX=disabled 1、临时关闭(不用重启机器): setenforce 0
四、yum源默认不配置
五、修改主机名
[root@git-nodel ~]# hostname git-nodel [root@git-nodel ~]# vi /etc/hostname git-nodel #保存xshell,再登录,就可以看到更改后的新用户名