linux»ñÈ¡ÍøÂç½Ó¿ÚÃû£ºÈçeth0
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<net/if.h>
static char *bad_interface_names[] = {
"lo:",
"lo",
"stf", /* pseudo-device 6to4 tunnel interface */
"gif", /* psuedo-device generic tunnel interface */
"dummy",
"vmnet",
NULL /* last entry must be NULL */
};
static int is_bad_interface_name(char *i) {
char **p;
for (p = bad_interface_names; *p; ++p)
if (strncmp(i, *p, strlen(*p)) == 0)
return 1;
return 0;
}
/* This finds the first interface which is up and is not the loopback
* interface or one of the interface types listed in bad_interface_names. */
static char *get_first_interface(void) {
struct if_nameindex * nameindex;
char *i = NULL;
int j = 0;
/* Use if_nameindex(3) instead? */
nameindex = if_nameindex();
if(nameindex == NULL) {
return NULL;
}
while(nameindex[j].if_index != 0) {
if (strcmp(nameindex[j].if_name, "lo") != 0 && !is_bad_interface_name(nameindex[j
Ïà¹ØÎĵµ£º
Here is small script that does this. Debian or Ubuntu GNU/Linux does
not comes with any SYS V init script (located in /etc/init.d directory)
.
You create a script as follows and use it to stop or flush the iptables rules.
Please don't type rules at command prompt. Use the script to sp ......
ÒÔÏÂÊÇÎҵIJâÊÔociµÄÀý×Ó£¡
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oci.h"
static OCIServer *srvhp;
static OCISession *p_session;
static OCIEnv &nb ......
pgrep ÊÇͨ¹ý³ÌÐòµÄÃû×ÖÀ´²éѯ½ø³ÌµÄ¹¤¾ß£¬Ò»°ãÊÇÓÃÀ´ÅжϳÌÐòÊÇ·ñÕýÔÚÔËÐС£ÔÚ·þÎñÆ÷µÄÅäÖú͹ÜÀíÖУ¬Õâ¸ö¹¤¾ß³£±»Ó¦Ó㬼òµ¥Ã÷ÁË£»
Ó÷¨£º
#ps ²ÎÊýÑ¡Ïî ³ÌÐòÃû
³£ÓòÎÊý
-l Áгö³ÌÐòÃûºÍ½ø³ÌID£»
-o ½ø³ÌÆðʼµÄID£»
-n ½ø³ÌÖÕÖ¹µÄID£»
¾ÙÀý£º
[root@localhost ~]# pgrep ......
linuxÖÐÓÃifconfigÎªÍø¿¨ÅäÖÃIPµØÖ·µÈ£¬ÔÚÏµÍ³ÖØÆôºó¾ÍʧЧÁË¡£ÎªÁ˱£Ö¤ÅäÖÃÓÀ¾ÃÉúЧ£¬ÐèÒª²ÉÓÃÐÞ¸ÄÅäÖÃÎļþµÄ¾²Ì¬ÅäÖ÷½·¨£¬×ܽáÈçÏ£º
1. cd /etc/sysconfig/network-scripts¡£
2. vi ifcfg-eth0(Ò²¿ÉÄÜÊÇeth1£¬eth2£¬·Ö±ð¶ÔÓ¦²»Í¬µÄÍø¿¨)
3. ÅäÖÃÄÚÈÝÈçÏ£º
DEVICE=eth0 //Íø¿¨É豸à ......