아래 코드로 간단하게 해결.
void ConfigureNetwork(char *ip, char *subnetmask, char *gateway)
{
char command[255];
sprintf(command, "ifconfig eth0 %s netmask %s up", ip, subnetmask);
system(command);
sprintf(command, "route add default gw %s", gateway);
system(command);
sleep(2);
// 보나스로 gateway에 ping 3번 날려줌
sprintf(command, "ping %s -c 3", gateway);
system(command);
}
{
char command[255];
sprintf(command, "ifconfig eth0 %s netmask %s up", ip, subnetmask);
system(command);
sprintf(command, "route add default gw %s", gateway);
system(command);
sleep(2);
// 보나스로 gateway에 ping 3번 날려줌
sprintf(command, "ping %s -c 3", gateway);
system(command);
}
'Linux' 카테고리의 다른 글
리눅스에서 tar를 이용해서 백업/복구하기 (0) | 2010.04.06 |
---|---|
USB Memory mount하기 (0) | 2010.04.02 |
우분투 기본 환경 설정 (0) | 2010.02.11 |
kubuntu에서 SVN server 설치하기 (0) | 2010.02.11 |
리눅스에서 윈도우 공유 폴더 마운트하기 (0) | 2010.02.10 |