程式設計例項 linux 設定網絡卡為混雜模式

2021-04-23 01:10:50 字數 564 閱讀 2199

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

#include 

int main(int argc, char **argv) 

/* set the network card in promiscuos mode */

strncpy(ethreq.ifr_name,"eth0",ifnamsiz);

if (ioctl(sock,siocgifflags,ðreq)==-1) 

ethreq.ifr_flags|=iff_promisc;

if (ioctl(sock,siocsifflags,ðreq)==-1) 

printf("success to set eth0 to promiscuos mode.../n");

return 0;

}

LINUX設定網絡卡

一 臨時啟用網絡卡並配置ip ifconfgi eth1 192.168.8.201 netmask 255.255.255.0 up 二 通過直接配置 etc sysconfig network scripts ifcfg eth1 一般為ifcfg eth0 vi etc sysconfig n...

linux 設定網絡卡

配置網絡卡 修改 etc sysconfig network scripts ifcfg eth0檔案,如果有多張網絡卡,則修改相應的網絡卡 vim etc sysconfig network scripts ifcfg eth0 device eth0 網絡卡對應的裝置別名 bootproto s...

linux 網絡卡設定

1 進入網絡卡目錄 cd etc sysconfig network scripts 2 網絡卡配置檔案內容 type ethernet proxy method none browser only no bootproto none defroute yes ipv4 failure fatal ...