免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6440 | 回复: 11
打印 上一主题 下一主题

关于netmask, /etc/netmasks 和 ifconfig -a 不一样 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-10-26 06:55 |只看该作者 |倒序浏览
碰到下面的问题,请哪位帮帮忙,先谢谢了。


Solaris10 x86 和 Solaris8 sparc 混合的环境, Server 是 Solairs10的,Clients 是两种都有。

所有的设置都一样:

IP range: 10.19.239.xxx
/etc/netmasks                           10.19.239.0     255.255.240.0
/etc/defaultrouter                      10.19.224.1


在Server上:

# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
        inet 10.19.239.211 netmask ff000000 broadcast 10.255.255.255
        ether 0:15:17:e3:4b:10

在Client上:

# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.19.239.205 netmask ffffff00 broadcast 10.19.239.255
        ether 0:14:4f:f:ff:db

Server上的netmask变成了255.0.0.0 broadcast 10.255.255.255, 而在Clients上却成了255.255.255.0 broadcast 10.19.239.255,

Server可以和其他subnet通话, Clients不可以,我只好用ifconfig命令:

ifconfig bge0 down
ifconfig beg0 netmask 255.0.0.0 broadcast 10.255.255.255
ifconfig bge0 up

请问这是什么原因呢? 我怎么解决? 谢谢。

论坛徽章:
0
2 [报告]
发表于 2011-10-26 07:30 |只看该作者
if your netmask is 255.255.255.240, then your network 10.19.239.0 is invalid (239 is out of the range. it should be between 0-224). That is why the netmask in /etc/netmasks is not taken.

论坛徽章:
0
3 [报告]
发表于 2011-10-26 07:38 |只看该作者
谢谢Brian,

我在安装机器的时候用的netmasks 255.255.240.0, 10.19.239.0是自动生成的,因为系统都是在10.19.239 subnet。

IP 和 netmask 都是客户提供给我的, 我需要修改netmask么? 谢谢

论坛徽章:
0
4 [报告]
发表于 2011-10-26 10:07 |只看该作者
When you install your machine, you need to give an IP address (or DHCP, which is not your case). Machine will never be able to 自动生成 a network based on netmask only. Tell your 客户 10.19.239.0 network and 255.255.240.0 netmask is a wrong match. If 客户 insists to use 239 network, you can make your netmask 255.255.0.0. However, this will broadcast packets to all class B network. From the default gateway 10.19.224.1, it looks like the network was intended to be 10.19.224.0.

论坛徽章:
0
5 [报告]
发表于 2011-10-26 10:38 |只看该作者
学习一下。

论坛徽章:
0
6 [报告]
发表于 2011-10-26 13:03 |只看该作者
Hi Brian, 谢谢。


系统没有用DHCP, 都有static IP, Server 10.19.239.211, Clients from 10.19.239.204 ~ 10.19.239.208, sys-unconfig时加netmask 255.255.240.0, defaultrouter 10.19.224.1

/etc/netmasks, /etc/defaultrouter 设置完全一样,但“ifconfig -a" 的结果不一样:

netmask ff000000 broadcast 10.255.255.255
netmask ffffff00 broadcast 10.19.239.255

我曾经看到过这样一句话, If the entry in /etc/defaultrouter is outside the subnet it will ignore the /etc/netmasks file and set a mask which allows it to talk to the router.

如果是这样,router 10.19.224.1, 那么ifconfig应该显示netmask ffff0000, 这样算对么?

其实我是一周前才把老的sparc server 和 其中 2 个sparc clients upgrade 到 新的 x86 Solaris10 的, 在这之前也是用的以上设置,工作却是正常的,我在想是不是应该在 /etc/rc2.d 下加一个Sxxxxxx把ifconfig down....ifconfig up 加进去。

客户的IT dept 是 out-sourcing, 和health department有合同,很难打交道,头痛的。

如果您能给我们讲一下如何计算IP 和 netmask 的关系,那就最好了, 谢谢。

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:54:45
7 [报告]
发表于 2011-10-26 13:09 |只看该作者
本帖最后由 yiguihuo 于 2011-10-26 14:48 编辑

看了你的问题我就不明白了,你这配置简直是随心所欲想怎么设就怎么设呀,你要根据你网络的环境设置呀,给你服务器分配的交换机端口是什么样你就要相应怎么设置,不然交换机端口配置是10.0.0.0的子网,你非要给服务器用个10.19.224.0的子网,上面又没有路由可不根其他子网不能通信

你的设置
应用:10.19.239.x
子网掩码:255.255.240.0/20
子网地址:10.19.224.0
地址范围:10.19.224.1-10.19.239.254
如果服务器接交换机端口是10.19.224.0/20子网,并且上面有路由
server 10.19.239.211 netmasks 10.19.239.0 255.255.240.0
clients 10.19.239.205 netmasks 10.19.239.0 255.255.240.0
如果就是10.0.0.0的子网那就直接255.255.255.0

论坛徽章:
0
8 [报告]
发表于 2011-10-26 13:47 |只看该作者
make a simple change to your /etc/netmasks  file as follow and restart your network or reboot your machine should work                        

10.19.224.0     255.255.240.0

论坛徽章:
1
19周年集字徽章-19
日期:2020-01-08 15:08:20
9 [报告]
发表于 2011-10-27 00:05 |只看该作者
建议楼主看看CCNA的知识

论坛徽章:
0
10 [报告]
发表于 2011-10-28 05:59 |只看该作者
谢谢楼上的,

IP, netmask, 和defaultrouter 都是客户提供的,是另外一家IT公司做的,我们肯定是不能改的。

Hi Brian,如果我把/etc/netmasks 从 10.19.239.0   255.255.240.0 改成 10.19.224.0  255.255.240.0, 而Server和所有的Clients都在10.19.239 subnet下,会不会造成Clients都不能和Server talk, 不能正常起来呢?

谢谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP