Master server-network configuration (ultra-detailed version)

Source: Internet
Author: User

Master server-network configuration (ultra-detailed version)
Preface

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:

 

vim /etc/network/interfaces

Set the content:

 

 

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

In this way, the IP address in the LAN is 192.168.1.110.

 

 

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 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 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

Then, modify the software source:

 

 

vim /etc/apt/sources.list

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 114.114.114.114 and 223.5.5.5 to avoid slow resolution or resolution failures caused by communication between China and other countries.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.