Objective
Used to be a virtual machine, and the use of desktop version, think a lot of things are taken for granted, this time directly to the server installed the system, and installed the server version, servers or the kind of large tens of thousands of-block server, suddenly demanded a lot of high, Found a lot of things are to their own configuration, and then got a bit, finally fix, really not easy, I found that the technical part of what has been done, fast Almighty.
The system environment for this article is unbuntu14.04 server LTS.
Set static IP
Set the static IP is mainly for the convenience of access in the LAN, if it is automatically assigned to the IP, each time will be different, landing time will be more trouble to detect every time the IP, if the static IP set there will be no problem of IP changes. The only thing to pay attention to is to prevent IP collisions when setting up a static IP, so IP can be set to a larger number within the interval, for example, if the segment is 192.168.1.100 to 192.168.1.199, that can be set to 192.168.1.180. Not really, you can also set the static IP binding MAC address, so it will not conflict, but this article does not describe how to bind the MAC address.
Modify the following files:
Vim/etc/network/interfaces
The contents should be as follows:
Auto loiface lo inet loopbackauto eth0iface eth0 inet staticaddress 192.168.1.110netmask 255.255.255.0network 192.168.1.0 Broadcast 192.168.1.255gateway 192.168.1.1
This allows us to set the IP address within the LAN to be 192.168.1.110.
Setting up access to an external network
Set up the static IP in the LAN, if the installation of Openssh-server, you can have other computers in the LAN to access, but, if you can not access the network, in my configuration process, is unable to install Openssh-server, Because installing this requires updating the source and downloading the installation.
There are a lot of people on the net to set up DNS by modifying the/etc/resolv.conf, but the setting here, if in the configuration process by shutting down the gateway, then configure, and then at the start of the gateway, it is possible to use the method. But once the server is off, on startup, if you open/etc/resolv.conf to view, you will be surprised to find that the contents of this file has been emptied, so, can not sisu the network, need to reconfigure.
To avoid the above problems, you can take the following approach:
Add DNS to/etc/resolvconf/resolv.conf.d/base and/etc/resolv.conf, respectively.
If you do not have a public IP or try to use the current network external IP, you can use two DNS:
#Googlenameserver 8.8.8.8nameserver 8.8.4.4#opendnsnameserver 208.67.222.222nameserver 208.67.220.220
because of Google's situation in China, you understand, so I mostly use OpenDNS IP.
OK, complete the above static IP and DNS configuration, because there is no problem accessing the extranet and being accessed by the local area network.
Get domestic source
At home, often use apt-get, software source because it is in the United States server, so the download installation is very slow, and may not even be completely unusable, so we can take the replacement download source of the address, with a domestic download source.
First, backup the software source:
Cp/etc/apt/sources.list/etc/apt/sources.listbak
Then, modify the software source:
Vim/etc/apt/sources.list
change the original foreign domain address to http://mirrors.163.com/(the following content is unchanged),
Set up LAN Access
Under Windows, it would be nice to visit directly with putty.
Set up extranet access
To enable the server can be accessed through the external network, the main or DNS settings, the original use of OpenDNS or Google's DNS resolution address to the public IP you have, if there are multiple servers corresponding to a public IP, you can set different ports to distinguish the use.
but the application of a public network IP is not so convenient, plus the cost is more expensive, so if you have more than one server to remote management, you can consider using peanut Shell (Linux version), and then bind the domain name, through the domain name to remotely manage the server. This is, it is recommended to change the IP of Google or OpenDNS to: 114.114.114.114 and 223.5.5.5, to avoid due to domestic and foreign communications caused by slow parsing or unresolved situations.
Reprint Please specify source: http://blog.csdn.net/luoyun614/article/details/42759615
Navigating the server-network configuration (Hyper-verbose version)