Master server-network configuration (ultra-detailed version)
I used virtual machines all the time and used the Desktop version. I think many things are taken for granted. This time I directly installed the system on the server and installed the server version, the server is still a type of large, tens of thousands of servers, and the requirements are a lot higher at once. I found that many things need to be configured by myself, and then I got it done. It's really not easy, I found that I have done everything in technology and I am almost omnipotent.
The system environment in this article is unbuntu14.04 server LTS.Set static IP
Static IP addresses are configured to facilitate access within the lan. If an IP address is automatically assigned, it will be different each time. It will be troublesome to check the IP address every time you log in, if a static IP address is set, no IP address changes. The only problem to be aware of is to prevent IP conflicts when setting static IP addresses. Therefore, you can try to set a large number of IP addresses in the interval, for example, if the range is 192.168.1.100 to 192.168.1.199, you can set it to 192.168.1.180. You can also bind a static IP address to a Mac address. This will not conflict, but this article will not introduce how to bind a Mac address.
Modify the following files:
auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.1.110netmask 255.255.255.0network 192.168.1.0broadcast 192.168.1.255gateway 192.168.1.1
Set Internet access
After a static IP address is configured in the LAN, if openssh-server is installed, other computers in the LAN can access the IP address. However, if the Internet address cannot be accessed, openssh-server cannot be installed during my configuration process, because it requires updating the source and downloading the installation.
Many people on the internet Modify/etc/resolv. conf to set DNS. However, if you disable the gateway, configure it, and then start the gateway during the configuration process, you can use this method. However, once the server is disabled, it is started. If/etc/resolv is enabled. check the conf file and you will be surprised to find that the content of this file has been cleared, so you cannot go to the Internet and need to reconfigure it.
To avoid the above problems, you can use the following methods:
Add DNS to/etc/resolvconf/resolv. conf. d/base and/etc/resolv. conf respectively.
If you do not have a public IP address or try to use an external IP address of the current network, you can use the following two DNS:
#Googlenameserver 126.96.36.199nameserver 188.8.131.52#OpenDNSnameserver 184.108.40.206nameserver 220.127.116.11Because of Google's situation in China, you know, I mostly use OpenDNS IP addresses.
OK, complete the above static IP and DNS configuration, because there is no problem when accessing the internet and being accessed by the LAN.Obtain domestic sources
In China, apt-get is often used, because the software source is a server in the United States, it is very slow to download and install, and may even be completely unavailable, therefore, we can change the address of the download software source to a domestic download source.
First, back up the software source:
cp /etc/apt/sources.list /etc/apt/sources.listbak
Change the original foreign domain name address to http://mirrors.163.com/(the following content unchanged ),
Set LAN Access
In windows, you can use putty for access.Set Internet access
To enable the server to access the server over the Internet, it is mainly about DNS settings. Change the DNS resolution address originally used by OpenDNS or Google to your own public IP address, if multiple servers correspond to one public IP address, you can set different ports for different use.
However, it is not that convenient to apply for a public IP address, and the cost is relatively high. Therefore, if multiple servers need remote management, you can consider using a peanut shell (for linux) and then bind the domain name, remote Server Management through domain names. After that, we recommend that you change the IP address of Google or OpenDNS to 18.104.22.168 and 22.214.171.124 to avoid slow resolution or resolution failures caused by communication between China and other countries.