ChinaUnix.net
相关文章推荐:

ioctl 设置ip地址

自己写的通过ioctl()来修改ip地址的程序,结果在运行(root)的时候报错, 不知道是memcpy(&ifr->ifr_addr,(struct sockaddr *)&addr, sizeof(addr));的问题,还是ioctl()调用的时候需要额外的参数, [code] int set_ipaddr(int sockfd, struct ifreq *ifr, char *ifname, char *ip) { struct sockaddr_in addr; bzero(&addr, sizeof(addr)); addr.sin_family = PF_INET; addr.sin_addr.s_addr ...

by dglwx - C/C++ - 2008-01-22 15:59:10 阅读(3711) 回复(3)

相关讨论

...... struct ifconf ifc; char devid[256]={0}; char is_find_dev = 0; struct ifreq buf[MAXINTERFACES]; ifc.ifc_len = sizeof(buf); ifc.ifc_buf = (caddr_t) buf; if (!ioctl(*sockfd, SIOCGIFCONF, (char *) &ifc)) { int interface = ifc.ifc_len / sizeof(struct ifreq); while (interface-- > 0) { if (!(ioctl(*sockfd, SIOCGIFADDR, (char *) &buf[interface]))) { if(0 == strncmp(deviceip->a...

by helin255 - C/C++ - 2009-04-02 14:55:28 阅读(1583) 回复(0)

各位大哥,我用install tcpip怎么设置不了ip地址?

by yanwenyuan - AIX - 2006-06-15 15:06:49 阅读(1531) 回复(2)

有一台操作系统是unix的服务器,现在要改其ip地址,如何改?打入uname -a ,显示出来的是FreeBSD

by fs_library - BSD - 2004-09-16 15:47:18 阅读(1482) 回复(7)

freebsd 中ip地址怎么配置,先谢谢了。

by wchengyu - BSD - 2005-10-22 19:02:40 阅读(5235) 回复(23)

请问各位大虾,如何在Linux中一个网卡上设置2个ip地址

by wxxW - Linux论坛 - 2003-09-22 14:48:01 阅读(659) 回复(9)

请问各位大虾,如何在Linux中一个网卡上设置2个ip地址

by wxxW - Linux论坛 - 2003-09-22 11:17:34 阅读(462) 回复(0)

设置ip地址, 比如怎么给61.*.*.*的地址设成255.255.255.248的掩码? 怎么设置网关,? 怎么样设置才通过ISA代理上网,? 多谢了

by xzh2001 - Linux论坛 - 2003-06-30 18:10:22 阅读(394) 回复(1)

设置网卡为混杂模式,代码如下: struct strioctl siotcl; siotcl.ic_cmd = MACIOC(11); siotcl.ic_timout = 0; siotcl.ic_len = 0; siotcl.ic_dp = NULL; // siotcl.ic_cmd = mibufed; fd = open("/dev/mdi/e3A0",O_RDWR); res = ioctl(fd,I_STR,&siotcl); if(res == -1) { perror("ioctl failed"); } else { printf("ioctl success\n"); } 但是运行后总出现错误,错误如下: ioctl failed...

by sufei7099 - 其他UNIX - 2008-06-18 11:38:02 阅读(1760) 回复(5)

如何设置ip地址呢?永久ip

by djgbl - Solaris - 2009-02-13 12:29:49 阅读(1529) 回复(4)
by xmwinforever - Solaris - 2008-12-22 12:45:08 阅读(1077) 回复(4)