Obtain the local IP address, mask, and gateway in Linux.
1. Obtain the local IP address and mask /******************************** ************************************* Function name: get_host_info* Parameter Name: local_ip (out) IP* Local_mask (out) mask* Return v
A test machine is installed in the IDC. The system is ubuntu9.04X64 and the master machine is IBMX336. The user needs to be dual-line. Therefore, one Nic is used to configure the telecom address, and the other Nic is configured with the Unicom address. after the system is installed, the IP address is configured and the Unicom address and the telecom address can only have one pi... A test machine is installed in the IDC. The system is ubuntu9.04 X64 an
This article is reproduced, describes how Ubuntu set up IP and network to connect to the networkIf you are using Ubuntu in a virtual machine, please refer to my previous article virtual machine net to set up the Network Settings section of the extranet, first set up the host network, and then configure the virtual machine Ubuntu IP and gatewayIf the host operating system is Ubuntu, please directly refer to
So what is the gateway? A gateway is essentially a network that leads to its IP address. For example, if Network A and Network B exist, the IP address range of Network A is "192.168.1.1 ~ 192. 168.1.254 ", The subnet mask is 255.255.255.0, And the IP address range of Network
IP address from the NIC to static, This field specifies the IP address of the NIC.
IPV6INIT = no
IPV6_AUTOCONF = no
NETMASK = 255.255.255.0 # network mask corresponding to the network adapter
NETWORK = 192.168.1.0 # NETWORK address of the NIC
ONBOOT = yes # whether to set this network interface when the system starts. if it is set to yes, the device is activated when the system starts.
II. CentOS
1. Check if connectivity is possible, ping the gateway using the ping commandThe beginning is always real unreachable2. Set IPsudo ifconfig eth0 133.133.133.190 netmask 255.255.255.0This sets the IP address and subnet mask of the NIC Eth03. Set the gateway sudo route add default GW 133.133.133.404. Ping the gateway to
Telecom address. Otherwise, you can only ping the China Unicom address. If both China Unicom and China Telecom addresses are configured, the two cannot be connected.
Because it is not our company's network, we are not clear about the Upper-layer implementation method. We only know that China Unicom and China Telecom lead to different VLANs, and China Telecom and China Unicom cannot pass through, however, other machines with the same intervention method can work normally out of the internet, so
Because to do static address configuration JS Check, find a lot of data found online are about ip,mask validity check, no ip,submask,gateway logical judgment, write down the code for the needs of the people reference.
Popularization of Gateway address knowledge:
1th: Proceed with the operation 1 with 1 1,1 with 0 for
Set or modify network configurations (IP gateway DNS) in CentOS)CentOS IP address Modification
# Ifconfig eth0 192.168.1.80
In this way, the IP address is changed192.168.1.80 (if you find that the network cannot be connected, you may need to change the gateway and DNS, whi
Because to do the static address configuration JS Check, find a lot of information found on the internet is about ip,mask validity check, no ip,submask,gateway logic judgment, write down the code for the needs of people reference.Popularization of Gateway address knowledge:is to proceed with the operation 1 with 1 with
temporarily modify IP address, gateway, hostname, DNS, effective immediately, no restart (after restart)1. Modify Host Name#hostname Slyar2. Modify the IP address (eth0 is the NIC name)#ifconfig eth0 192.168.1.5 netmask 255.255.255.03. Modify the default gateway (Eth0 is the NIC name)#route add default GW 192.168.1.1 D
= 12.168.1.2 # If you set the method for obtaining the IP address from the NIC to static, This field specifies the IP address of the NIC.IPV6INIT = noIPV6_AUTOCONF = noNETMASK = 255.255.255.0 # network mask corresponding to the network adapterNETWORK = 192.168.1.0 # NETWORK address of the NICONBOOT = yes # whether to set this network interface when the system starts. if it is set to yes, the device is acti
Today came back to open the virtual machine, the results with Xshell connection is not, the feeling should be my local IP has changed, my virtual machine is located in a computer connection is another B computer sent wifi,a computer This IP is automatically obtained, originally a computer IP for 173.23.x.x, In order to set a good memory
Temporarily modify IP address, gateway, host name, DNS, immediately effective, no reboot (failure after reboot)
1. Modify Host Name
The code is as follows:
#hostname Slyar
2. Modify IP address (eth0 is the name of the network card)
The code is as follows:
#ifconfig eth0 192.168.1.5 netmask 255.255.255.0
3. Modify th
Temporarily modify IP address, gateway, host name, DNS, immediately effective, no reboot (failure after reboot)
1. Modify Host Name
The code is as follows:
#hostname Slyar
2. Modify IP address (eth0 is the name of the network card)
The code is as follows:
#ifconfig eth0 192.168.1.5 netmask 255.255.255.0
3. Modify the default
= yes # whether to set this network interface when the system starts. If it is set to yes, the device is activated when the system starts.2. Modify the GatewayModify the gateway configuration file of the corresponding Nic[Root @ centos] # vi/etc/sysconfig/networkModify the following contentNETWORKING = yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system ser
: System: UbuntuServer11.10IP address: 192.168.21.168 subnet mask: 255.255.255.0 Gateway: 192.168.21.2DNS: 8.8.8.88.8.4.4 operation: 1. Set IP address, Gateway nano/
Note:
The system is Ubuntu Server 11.10.
IP Address: 192.168.21.168
Subnet Mask: 255.255.255.0
Gateway: 192.
JIU Xue training network-the largest training platform in China!Free course release, demand, search for courses, lecturers, institutionsTraining courses: Computer, English, Japanese, enterprise management, occupational, French, software, driving, oral English, logistics, chefs, networking, networking, beauty, talent, accounting, stocks, dance...
Recently, I was transferred to Shanghai Telecom to create a project. Due to the inconsistency between the IP
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.