原文連接: https://www.cnblogs.com/GaZeon/p/5393853.html
Centos7網絡配置,vsftpd安裝及530報錯解決
html
今天在虛擬機安裝CentOS7,準備全新安裝LTMP,結果又是一堆問題,不過正好由於這些出錯,又給本身長了見識。centos
最小化安裝CentOs7後,ifconfig提示command not found,查了一下是ifconfig的net-tools沒裝,因而yum search ifconfig查找安裝包,又是提示Cannot find a valid baseurl for repo: base/7/x86_6,才發現網卡還沒配好,查了一下,原來是centos7下ip命令替代了ifconfig,使用ip addr:網絡
[root@localhost usr]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
顯示有lo,eno16777736兩個網卡,因而ls /etc/sysconfig/network-scripts/ 查看:less
[root@localhost usr]# ls /etc/sysconfig/network-scripts/ ifcfg-eno16777736 ifdown-ippp ifdown-sit ifup-bnep ifup-plip ifup-Team network-functions-ipv6 ifcfg-lo ifdown-ipv6 ifdown-Team ifup-eth ifup-plusb ifup-TeamPort ifdown ifdown-isdn ifdown-TeamPort ifup-ib ifup-post ifup-tunnel ifdown-bnep ifdown-post ifdown-tunnel ifup-ippp ifup-ppp ifup-wireless ifdown-eth ifdown-ppp ifup ifup-ipv6 ifup-routes init.ipv6-global ifdown-ib ifdown-routes ifup-aliases ifup-isdn ifup-sit network-functions
發現網卡名從本來的ifcfg-eth0變成了ifcfg-eno16777736(以你的網卡名爲準) ,此時vi打開該配置文件,修改並添加部分參數 vi /etc/sysconfig/network-scripts/ifcfg-eno16777736tcp
TYPE=Ethernet #BOOTPROTO=dhcp #註釋此行,從而使用靜態IP DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 UUID=2fae2065-54b2-4e14-8601-d249e85f83e7 DEVICE=eno16777736 ONBOOT=yes #no改成yes,開機啓動服務 #########添加以下參數,ip與宿主機同一網段爲準######## IPADDR0=192.168.1.109 PREFIX0=24 GATEWAY0=192.168.1.1 DNS1=192.168.1.1
shutdown -r 重啓虛擬機後 ip addr ,能夠看見網卡已經設置好 ,ping 一下宿主機確認網絡是否連通,若是不行,能夠設置虛擬機網絡爲橋接模式,service network restart 再ping看看。oop
成功後,便可安裝ifconfig命令。yum search ifconfig 搜索安裝包, 匹配到net-tools.x86_64,因而yum install net-tools.x86_64,一路y下去,安裝完畢,此時輸入ifconfig,顯示網卡信息,OK!post
yum search vsftpd。匹配vsftpd.x86_64。因而 yum install vsftpd.x86_64,一路y下去,安裝完畢。service vsftpd start開啓ftp服務。要使用ftp必須開啓21端口。Centos 7使用firewalld代替了原來的iptables。要開放21端口,使用下面命令:測試
firewall-cmd --zone=public --add-port=21/tcp --permanent
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeedui
vsftpd將禁止名單指向了/etc/vsftpd/ftpusers,因而 vi /etc/vsftpd/ftpusers 發現root在名單上,因而 刪除root,保存,重啓vsftpd。登陸FTP OK成功!