single host multiple IP address configuration in Linux
2011-11-01 11:01
417 查看
Just write for avoid the forget.
1. configure multiple IP address in /etc/hosts
If we want to assign two IP addresses to a single host named "test", we can just simply configure the /etc/hosts like:
192.168.1.1 test
192.168.1.2 test
After this configuration, if we call the C function gethostbyname("test") to get the IP addresses of host "test", most probably it returns only one single IP address.
2. turn the "multi on" in /etc/host.conf
add the following line to the end of /etc/host.conf
multi on
After this modification, the gethostbyname("test") will return two IP addresses.
1. configure multiple IP address in /etc/hosts
If we want to assign two IP addresses to a single host named "test", we can just simply configure the /etc/hosts like:
192.168.1.1 test
192.168.1.2 test
After this configuration, if we call the C function gethostbyname("test") to get the IP addresses of host "test", most probably it returns only one single IP address.
2. turn the "multi on" in /etc/host.conf
add the following line to the end of /etc/host.conf
multi on
After this modification, the gethostbyname("test") will return two IP addresses.
相关文章推荐
- Map Multiple Domain Names to Web Sites in IIS at a Single IP Address
- Binding multiple IP address in one NIC in linux
- Linux服务启动报:Address already in use 解决方法:预留端口避免占用ip_local_reserved_ports
- C language——read ip address in linux
- How to check ip address in linux
- Static IP address in linux
- C language——convert ip address string into uint in linux
- CentOS 6.5/Linux 重启网卡报错 Determining if ip address x.x.x.x is already in use
- How to Find Your IP Address in Ubuntu Linux
- How To: Make VirtualBox Use Your Router’s DHCP to get an IP Address in Linux
- Linux_SSH Warning: the RSA host key for differs from the key for the IP address
- IP Address Configuration on Linux (RHEL 5.4)
- How to check ip address in linux
- [Linux] Update DHCP ip address in Linux.
- linux C Get/Set IP Address
- Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hos
- linux--异常--NoRouteToHostException: Cannot assign requested address有关问题
- linux安装mq报 Illegal character in hostname at index 15
- github工具使用新手常见问题:Warning: Permanently added the RSA host key for IP address 'X.X.X.X' to the
- Linux下Socket编程的端口问题( Bind error: Address already in use )