vxworks里怎么改ip

vxworks里怎么改ip,第1张

ifAddrSet( )

NAME

ifAddrSet( ) - set an interface address for a network

interface

SYNOPSIS

STATUS ifAddrSet

(

char * interfaceName, /* name of interface to configure, i.e. ei0 */

char * interfaceAddress /* Internet address to assign to interface */

)

DESCRIPTION

This routine assigns an Internet address to a specified network interface.

The Internet address can be a host name or a standard Internet address format

(e.g., 90.0.0.4). If a host name is specified, it should already have been added

to the host table with hostAdd( ).

A successful call to ifAddrSet( )

results in the addition of a new route.

The subnet mask used in determining the network portion of the address will

be that set by ifMaskSet( ), or the

default class mask if ifMaskSet( )

has not been called. It is standard practice to call ifMaskSet( ) prior to calling ifAddrSet( ).

RETURNS

OK, or ERROR if the interface cannot be set.

按照我们的做法,我们会将VXWORKS的IP设置在BSP的引导线中,这就和BSP的设计相关了。

但是最终是调用一个ifAddrSet()来实现ipaddress和interface的绑定,同时需要指定netmask通过调用ifMaskSet( ) 。

在windows下是可以ping通vxworks的。需要注意的是,pc 和vxworks属于同一网段,如果不在同一网段,需要添加路由。

也可以叫共用一个IP吧。。我想

cat "/etc/modules.conf" 中加上

alias bond0 bonding

options bond0 miimon=100 mode=0

其中mode=0为负载平衡,

mode=1为备份时。。我试过把网线拨掉一根也完全正常。。因为另外一台一直在ping

[root@shlinux root]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

IPADDR=192.168.7.112

[root@shlinux root]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

IPADDR=192.168.7.112

[root@shlinux root]# cat /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=static

IPADDR=192.168.7.112

NETMASK=255.255.255.0

NETWORK=192.168.7.0

BROADCAST=192.168.7.255

ONBOOT=yes

在"/etc/rc.d/rc.local"中加如下两句

ifenslave bond0 eth0 eth1

service network restart别忘了这句,否则eth1就会启动不了,兄弟们可能会发现在启动的时候会有eth1失败的提示,不过有了这句之後会发现後OK了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11304194.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存