What Is Promiscuous Mode?
Promiscuous mode is a term in computer networks. It means that the network card of a machine can receive all data streams passing through it, regardless of whether its destination address is it.
- Promiscuous Mode means that a machine can receive all data streams passing through it, regardless of whether its destination address is him. It is relative to the normal mode (also known as "non-hybrid mode"). This is
- Usually used when needed
- In the network,
- char * eth_name = "eth0"; // Promiscuous settings for network card eth0
- struct ifreq ethreq; // Network interface structure
- strncpy (ethreq.ifr_name, eth_name, IFNAMSIZ); // Specify the network card name if (-1 == ioctl (sock_raw_fd, SIOCGIFFLAGS, & ethreq)) // Get the network interface {
perror ("ioctl");
close (sock_raw_fd);
exit (-1);
}
- / * Used here because it is necessary to add a "hybrid" method to the flag bit while retaining the original setting * /
ethreq.ifr_flags | = IFF_PROMISC;
if (-1 == ioctl (sock_raw_fd, SIOCSIFFLAGS, & ethreq)) // write the flag bit setting to {
perror ("ioctl");
close (sock_raw_fd);
exit (-1);
}