转载:给debian的单网卡配置多IP时的提示信息
2011-03-08 16:14
513 查看
How to assign multiple IP’s in Debian Linux
14 May, 2010 Linux SuganDebian Linux command to get into network interface card
#vi /etc/network/interfaces
How to assign multiple IP addresses in debian linux:
You can assign multiple IP addresses to the same network interface by using interface alias. This is useful if you need to have more than one server visible on the internet. Note that for multiple Apache servers you can use virtual hosts to add as many servers as you like with one single IP address.Apache simply utilises the domain name supplied by the client in the http host header.
You must turn off dhcp because you must use static assignment if you are configuring multiple IPs, so basically this file is:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.90
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Assuming that you interface is eth0, you can assign three IP addresses editing /etc/network/interfaces similar to this:
# the loopback interface
auto lo
iface lo inet loopback
#
auto eth0
iface eth0 inet static
address 192.168.1.42
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
auto eth0:0
iface eth0:0 inet static
address 192.168.1.41
netmask 255.255.255.0
broadcast 192.168.1.255
auto eth0:1
iface eth0:1 inet static
address 192.168.1.43
netmask 255.255.255.0
broadcast 192.168.1.255
auto eth0:2
iface eth0:2 inet static
address 192.168.1.44
netmask 255.255.255.0
broadcast 192.168.1.255
Note that gateway is only assigned to eth0. If you include dns-nameservers, it should also only be specified for eth0.
If you make changes to this file you can cause them to take effect by running:
/etc/init.d/networking restart
# /etc/init.d/networking restart
Reconfiguring network interfaces…if-up.d/mountnfs[eth0]: waiting for interface eth0:0 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning).
done.
How to fix if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning). ?
Reconfiguring network interfaces…if-up.d/mountnfs[eth0]: waiting for interface eth0:0 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:1 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:0]: waiting for interface eth0:2 before doing NFS mounts (warning).
if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS mounts (warning).
done.
Solution:
It means that it is making sure that all ‘net interfaces are up before trying to mount a network based filesystem.
# chmod -x /etc/network/if-up.d/mountnfs
合理的解释:
I wouldn't worry too much. It appears to be a warning that can be ignored in the presence of multiple interfaces.
What is happening is that the primary eth0 interface is brought up (via ifup) due to its entry in /etc/network/interfaces. In response to that, scripts in /etc/network/if-up.d will run automatically. And one of those scripts is mountnfs to automatically mount any filesystems in /etc/fstab that are marked as nfs. You'll find the code that generates the warning in /etc/network/if-up.d/mountnfs.
I'm guessing at why the code was written this way, but since the script can't tell with certainty which (if you have multiple) of your network interfaces may be needed for the NFS mount to succeed, it checks all the "auto" interfaces in /etc/network/interfaces and if any aren't configured yet, it exits with the warning you saw. In your case, you have a second, eth0:0, alias interface, that holds your secondary address which isn't up yet - thus the warning.
But since the same script will then re-run on each subsequent interface coming up, when it gets to the final interface it proceeds to mount any network filesystems.
From the script on Debian (assuming Debian 5 - I don't have a Debian 4 image to check), it appears that the "am I the last interface to come up" check is done even before checking fstab so you can get this warning even if you don't have any nfs filesystems configured.
If the message annoys you, and you don't have any nfs mounts, you can always get rid of the mountnfs script in /etc/network/if-up.d, or chmod -x the script, which will cause it to be skipped.
相关文章推荐
- [转载]linux下一个网卡配置多个ip
- Debian系统学习笔记(2):网卡配置信息
- 浅写一篇 debian 双网卡固定IP配置DHCP实例
- 脚本实现centos7修改二块网卡名称并配置ip信息
- vmware中启动网卡提示:正在决定 eth0 的 IP 信息...失败;无链接。检查电缆吗?问题的解决方法
- CentOS之——双网卡双IP双网关配置
- Qt: 取得网卡的MAC地址, IP等信息
- openstack 虚拟机网卡配置多个ip-centos
- 使EntLib5的Unity配置文件显示提示信息
- 在linux纯命令下如何去配置网卡信息
- Linux环境下配置php开发环境(我转载的原因是里面有我要的配置虚拟主机的提示)
- 8021x 获取IP信息失败,请检查锐捷认证客户端当前配置是否符合所在网络的要求,检查完毕后尝试重新认证
- 单网卡设置双IP(ubuntu,debian)
- Uploadify 配置错误信息提示
- windows配置网卡IP脚本和配置路由条目、默认路由
- C++ 中通过GetAdaptersInfo获取网卡配置和Ip地址信息
- debian中安装virtualbox提示virtualbox 尚未配置时的处理方法
- 内网无路由跨网络服务——单网卡双IP配置
- linux之修改静态ip,修改网卡名称为eth0,以及iso装系统后的配置ip
- 使用ifconfig命令给网卡配置ip别名