Set multiple IP addresses for one network card

Source: Internet
Author: User
Set multiple IP addresses for one NIC-Linux Enterprise Application-Linux server application information. For more information, see. With a laptop, the most troublesome thing is that, because the network segment is different at home and in the company, you must switch the IP address each time to access the Internet. Today add a second IP address to the NIC, that is, generate a ifcfg-eth0: 1 to solve this problem:

1)/etc/sysconfig/netwok-scripts/ifcfg-eth0 (172.16.1.68)
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
IPADDR = 172.16.1.68
NETMASK = 255.255.254.0
TYPE = Ethernet
USERCTL = no
IPV6INIT = no
PEERDNS = yes
BROADCAST = 172.16.1.255
NETWORK = 172.16.0.0
HWADDR = 00: 17: 08: 2d: 93: 66
GATEWAY = 172.16.1.254


2) 1)/etc/sysconfig/netwok-scripts/ifcfg-eth0: 1 (192.168.0.103)
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = none
IPADDR = 192.168.0.103
NETMASK = 255.255.255.0
TYPE = Ethernet
USERCTL = no
IPV6INIT = no
PEERDNS = yes
BROADCAST = 192.168.0.255
NETWORK = 192.168.0.0
HWADDR = 00: 17: 08: 2d: 93: 66
GATEWAY = 192.168.0.1

3)/etc/resolv. conf
; Generated by/sbin/dhclient-script
Search localdomain
Nameserver 202. xx
Nameserver 172.16.1.254
Nameserver 192.168.0.1

In the future, you don't need to switch the IP address at home, so you can use it directly.

(What is depressing today is that 192 has been combined into 172, and it takes only half a day to see it)

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.