1. What is the command to get an IP address automatically? Do you know under what circumstances your Linux can automatically obtain an IP address?
A: (1) Use the Dhclient command in Linux to obtain an available IP address from the DHCP server
(2) First, the need to activate the network card eth0; second, if Linux is a virtual machine, then you need to set up the network of the virtual machine is bridged
Mode or NAT mode, the bridge mode must automatically obtain an IP address in case the network administrator allows the assignment of IP to succeed;
Nat mode is generally successful; Finally, you can configure the eth0 configuration file/etc/sysconfig/network-scripts/ifcfg-
Eth0, modify the Onboot=yes so that it starts up, modify the bootproto=dhcp so that it gets the IP automatically with DHCP.
2. Remotely connect a Linux server and require the Linux server to turn on the sshd service, which port does the SSHD service listen to by default? Can this port be customized? If so, how can I customize it?
A: The SSHD service listens to port 22 by default, and can be customized by using the command vi/etc/ssh/sshd_config.
"#Port 22" to "Port 2222" or insert a line "port 2222" under "#Port 22" to set the default 22
Port is modified to port number No. 2222.
3. What are the common terminal tools for remote connection Linux?
Answer: Putty, Xshell, SECURECRT, Xmanager, etc.
4. Manually configure the IP, which configuration file needs to be modified? Change the default configuration file, which areas need to be changed, which lines need to be added?
A: (1) Use VI to modify the eth0 configuration file Ifcfg-eth0:vi/etc/sysconfig/network-scripts/ifcfg-eth0
(2) Change the onboot parameter to "yes" to start the boot. The Bootproto parameter represents the way to obtain the IP,
It is changed to "Static" and the IP is configured using manual mode. Add the following lines of information at the end of the configuration file:
ipaddr=192.168.11.16 (IP address to assign)
netmask=255.255.255.0 (Subnet mask)
gateway=192.168.11.1 (gateway address, usually referred to as the Router address)
dns1=192.168.11.1 (DNS address, default is gateway address)
dns2=8.8.8.8 (Alternate DNS address, here is Google's DNS server address)
5. What is the command to restart the network service?
Answer: Service network restart or/etc/init.d/network restart
6. Which configuration file do I need to modify to configure DNS?
A: (1) In general, if you configure DNS separately, you need to modify the/etc/resolv.conf file, which modifies the values of the following parameters
For the desired value
NameServer #定义DNS服务器的IP地址
Domain #定义本地域名
Search #定义域名的搜索列表
Sortlist #对返回的域名进行排序
(2) However, if DHCP is set to automatically obtain an IP address,/etc/resolv.conf will
Automatic modification of DNS information in/etc/sysconfig/network-scripts/ifcfg-eth0
7. Please check the information on how the decryption key pair works.
A: A key pair refers to a public and private key, asymmetric encryption, where the public and private keys are two different. But they can be done by specific
Cryptographic algorithms are validated against each other. Public keys are public, commonly used to encrypt files, private keys are not exposed, and can be used to decrypt files. For example
, a generates a pair of keys Publica and Privatea, if B wants to send a message to a, need to get a publica, give the information
Encryption, sent to A,a using Privatea decryption information, even if the information is intercepted, no privatea can not be solved.
Similarly A to give B information also to live B's PUBLICB. The private key can be used for signing, a message is sent to the PUBLICB using
b, in which to use Privatea to do a digital signature, B can use a to his Publica verify this information is a sent to
, to prevent repudiation and forgery.
8. Use Putty's generate key pair tool to generate a public and private key, and set the private key password, copy the public key to Linux, and implement a key to log on to your Linux. Note that the two key points are to set the. SSH directory permissions and to turn off SELinux.
A: (1) Open the Puttygen tool click Generate generate a pair of keys, during the generation of the mouse to move in the blank area to quickly
Get more random numbers at a speed
(2) Set notes and passwords, and save the private key to local
(3) Create a directory on a Linux server: Mkdir/root/.ssh modify its permissions: chmod 700/root/.ssh
and create a file under directory/root/.ssh: Vi/root/.ssh/authorized_keys modify its permissions:
chmod 600/root/.ssh/authorized_keys copies the generated public key, pastes it into the file, and saves the exit.
(4) Close two kinds of firewalls: (a) Turn off SELinux: temporarily off Setenforce 0 permanently closed, edit
/etc/selinux/config change selinux=enforcing to selinux=disabled restart effective (b) close
NetFilter: Temporary shutdown iptables-f permanently shut down service iptables save restart takes effect
9. How can I temporarily close selinux? How do I permanently turn off selinux?
A: Temporarily close SELinux can use the command: Setenforce 0
Permanently close SELinux can modify the configuration file: Vi/etc/selinux/config
Modify selinux=disabled Save exit, restart effective
10. How do I temporarily configure my host name? And how do you get it to restart and still take effect?
A: Use the command hostname Rachy can temporarily configure the host name Rachy, if you want to restart after the effective, you need to modify the
/etc/sysconfig/network file, modify the Hostname=rachy
11. What is the command to view Linux with several NICs and network card IP?
Answer: ifconfig-a
Under CentOS, you can use the Setup command to configure IP for the network card, and if not, how do I install the command?
Answer: Yum install-y setuptool System-config-network-tui
13. Check to see if a network card is connected to the network cable command?
Answer: Mii-tool eth0
14. What is the command to view the system time? How do I change the system time?
A: You can use the command to view the system time: date;
Modify the system time can use the command: date-s "2016-12-2 21:51:36"
If you want to automatically synchronize time on the time server:
Installing the NTP tool: Yum install-y NTP
Execute command after installation: Ntpdate time.windows.com
15. How do I adjust the font and size of the putty display? How do I change the character set of the putty so that it supports Chinese display?
A: (1) Adjust the font: In the Putty configuration in the left tree directory to open the window under the appearance, in the right
You can set the font and size by clicking Change on the side of the font setting.
(2) Support Chinese: Open the translation under window in the left tree directory in Putty configuration, on the right
Remote character Set drop-down box to select the UTF-8 font.
16. How to restrict IP login?
A: (1) White list form-Specify the IP that can be logged in, all others do not allow
such as: Only allow 192.168.0.100 and 192.168.0.150 two IP addresses can log in, other addresses are not allowed to log on.
1. Open the "whitelist" file Vi/etc/hosts.allow add a line sshd:192.168.0.100 192.168.0.150
Save exit
2. Open "Blacklist" file Vi/etc/hosts.deny add a row Sshd:all save exit
(2) Blacklist form-Specify IP that is not allowed to log on, all other allowed
such as: Limit 192.168.0.1 only, other addresses can be logged in
Open "Blacklist" file Vi/etc/hosts.deny add a row sshd:192.168.0.1 save exit.
If there is an IP address, first see if there is hosts.allow, if there is, then direct release; if not, look.
There is no hosts.deny, if any, access is forbidden, if not, release. If two files are all, according to the priority check
The principles of Hosts.allow documents are fully released.
Reference: http://www.lishiming.net/thread-5544-1-1.html
17. How to make the root account cannot use the password can only use the key remote login?
A: Modify the sshd configuration file: Vi/etc/ssh/sshd_config Add a line to the last face
Permitrootlogin Without-password
Save exit, restart SSHD service services sshd restart
Reference: http://www.lishiming.net/thread-5545-1-1.html
18. How do I make the root account not allowed to log on remotely, and the ordinary account can?
A: Modify the sshd configuration file: Vi/etc/ssh/sshd_config Add a line to the last face
Permitrootlogin No
Save exit, restart SSHD service services sshd restart
Reference: http://www.lishiming.net/thread-5546-1-1.html
What is the command to get an IP address automatically? Do you know under what circumstances your Linux can automatically obtain an IP address?