CentOS VMware12 pro installation (ssh, ftp), centosvmware12
OS: CentOS-7-x86_64-Minimal-1511.iso
VM: VMware 12 pro
If CentOS is selected for the first operating system installation, no Nic is displayed. No resistance to reinstall.
For the second installation, select CentOS7 64-bit for the operating system type. This time, the NIC is available.
At this point, the operating system has been installed and the Internet is ready.
Update the system: sudo yum update & sudo yum upgrade
Install ssh and ftp: sudo yum install openssh vsftp
Configuration File: ssh:/etc/ssh/ssh_config ftp:/etc/vsftpd. conf
Activate service: sudo service vsftpd/ssh [start | restart | stop]
Check whether the port is Enabled: ss-ant
Ftp upload Configuration:
Getsebool-a | grep ftpd
Setsebool ftpd_full_access on
Service vsftpd restart
Note: Some Usage of the Second Generation ip-tools
I. Replacing ifconfig route arp netstat with ip ss commands
1. ip commands
Ip [OPTIONS] OBJECT {COMMAND | help}
The OBJECT and COMMAND can be abbreviated to a letter.
Ip help allows you to view the OBJECT List and OPTIONS, short for ip h.
Ip <OBJECT> help to view help for this OBJECT, such as ip addr help, short for ip a h
Ip addr: view the network interface address, abbreviated as ip.
Check the network interface address and replace ifconfig:
[Root @ centos7 ~] # 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: enp0s3: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 08: 00: 27: 15: 35: d2 brd ff: ff
Inet 192.168.150.110/24 brd 192.168.150.255 scope global enp0s3
Valid_lft forever preferred_lft forever
Inet6 fe80: a00: 27ff: fe15: 35d2/64 scope link
Valid_lft forever preferred_lft forever
[Root @ centos7 ~] #
Network Interface statistics
[Root @ centos7 ~] # Ip-s link
1: lo: <LOOPBACK, UP, LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
Link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
2: enp0s3: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
Link/ether 08: 00: 27: 15: 35: d2 brd ff: ff
RX: bytes packets errors dropped overrun mcast
8135366 131454 0 0 456
TX: bytes packets errors dropped carrier collsns
646297 2441 0 0 0 0
2. ip route display and route setting
Show route table
[Root @ centos7 ~] # Ip route
Default via 192.168.150.254 dev enp0s3 proto static metric 1024
192.168.150.0/24 dev enp0s3 proto kernel scope link src 192.168.150.110
The format is too ugly. (the default gateway and LAN route are displayed. The two lines have no common content ):
[Root @ centos7 tmp] # ip route | column-t
Default via 192.168.150.254 dev enp0s3 proto static metric 1024
192.168.150.0/24 dev enp0s3 proto kernel scope link src 192.168.150.110
Add a static route
[Root @ centos7 ~] # Ip route add 10.15.150.0/24 via 192.168.150.253 dev enp0s3
[Root @ centos7 ~] #
[Root @ centos7 ~] # Ip route | column-t
Default via 192.168.150.254 dev enp0s3 proto static metric 1024
10.15.150.0/24 via 192.168.150.253 dev enp0s3 proto static metric 1
192.168.150.0/24 dev enp0s3 proto kernel scope link src 192.168.150.110
[Root @ centos7 ~] #
[Root @ centos7 ~] # Ping 10.15.150.1
PING 10.15.150.1 (10.15.150.1) 56 (84) bytes of data.
64 bytes from 10.15.150.1: icmp_seq = 1 ttl = 63 time = 1.77 MS
64 bytes from 10.15.150.1: icmp_seq = 1 ttl = 63 time = 1.08 MS
64 bytes from 10.15.150.1: icmp_seq = 1 ttl = 63 time = 1.57 MS
^ C
To delete a static route, you only need to replace add with del, or simply write only to the target network.
[Root @ centos7 ~] # Ip route del 10.15.150.0/24
[Root @ centos7 ~] #
However, the changes made by the ip route command to the route cannot be saved, and the restart will be gone.
The document on the RHEL official website describes how to set permanent static routes. Only one method is successfully tested:
[Root @ centos7 ~] # Echo "10.15.150.0/24 via 192.168.150.253 dev enp0s3">/etc/sysconfig/network-scripts/route-enp0s3
Restart the computer, or disable and enp0s3 to take effect,
Note: The/etc/sysconfig/static-routes and/etc/sysconfig/network configuration files are not easy to use.
3. Replace arp-n with ip neighbor
[Root @ centos7 ~] # Ip nei
192.168.150.254 dev enp0s3 lladdr b8: a3: 86: 37: bd: f8 STALE
192.168.150.100 dev enp0s3 lladdr 90: b1: 1c: 94: a1: 20 DELAY
192.168.150.253 dev enp0s3 lladdr 00: 09: 0f: 85: 86: b9 STALE
4. Use ss instead of netstat
Corresponding to netstat-ant
[Root @ centos7 ~] # Ss-ant
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 100 127.0.0.1: 25 *:*
LISTEN 0 128 *: 22 *:*
ESTAB 0 0 192.168.150.110: 22 192.168.150.100: 53233
LISTEN 0 100: 1: 25 :::*
LISTEN 0 128: 22 :::*
Corresponding to netstat-antp
[Root @ centos7 tmp] # ss-antp
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 100 127.0.0.1: 25 *:*
Users :( ("master", 1817,13 ))
LISTEN 0 128 *: 22 *:*
Users :( ("sshd", 1288,3 ))
ESTAB 0 0 192.168.150.110: 22 192.168.150.100: 59413
Users :( ("sshd", 2299,3 ))
LISTEN 0 100: 1: 25 :::*
Users :( ("master", 1817,14 ))
LISTEN 0 128: 22 :::*
Users :( ("sshd", 1288,4 ))
[Root @ centos7 tmp] #
Look really awkward, no matter how wide the terminal screen, users: part will be folded to the next line, actually in one line.
After formatting, the content is neat, but the header line string is:
[Root @ centos7 tmp] # ss-antp | column-t
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 100 127.0.0.1: 25 *: * users :( ("master", 1817,13 ))
LISTEN 0 128 *: 22 *: * users :( ("sshd", 1288,3 ))
ESTAB 0 0 192.168.150.110: 22 192.168.150.100: 59413 users :( ("sshd", 2299,3 ))
LISTEN 0 100: 1: 25: * users :( ("master ))
LISTEN 0 128: 22: * users :( ("sshd", 1288,4 ))
5. Old network scripts and ifcfg files
Starting from Centos7, the NetworkManager service manages the network. Compared with the old/etc/init. d/network script, NetworkManager is a dynamic and event-driven network management service. Old/etc/init. d/network, ifup, ifdown, and so on are still in the STANDBY state, that is, when NetworkManager is running, these scripts call NetworkManager to complete network configuration tasks in most cases; when NetworkManager is running, these scripts manage the network according to the old tradition.
[Root @ centos7 ~] #/Etc/init. d/network start
Starting network (via systemctl): [OK]
Note (via systemctl ).
6. network configuration file:
/Etc/sysconfig/network is a global setting, and there is nothing in it by default
After the/etc/hostname is modified with nmtui, the host name is saved here
/Etc/resolv. conf: Save the DNS settings. You do not need to manually modify the settings. The DNS settings in nmtui will appear here.
/Etc/sysconfig/network-scripts/connection configuration information ifcfg File
/Etc/NetworkManager/system-connections/VPN, mobile broadband, PPPoE connection