PPPOE 에 대한 개념 설명과 이를 사용하는 방법에 대해 다룬다.
PPPOE 란
PPPOE 는 Point-to-Point Protocol over Ethernet 의 약자로, 지금은 거의 찾아보기 힘든 ASDL 환경에서 사용한 기술이다. 이더넷 프레임 안에 PPP 프레임을 넣어 만들 때 사용되는 통신 프로토콜이다. 사용자가 이더넷을 이용해서 ADSL 송수신 장비(모뎀)를 연결하는 ADSL 서비스에서 주로 사용된다. UUNET, Redback Networks와 RouterWare가 개발한 프로토콜이다.
PPPoE는 모뎀과 같은 고객의 공용 장비를 통해 하나의 이더넷을 이용하는 여러 사용자들을 원격지에 있는 사이트에 연결하기 위한 규격이다. PPPoE 기술은 사무실이나 빌딩 내의 모든 사용자들이 하나의 DSL이나 케이블 모뎀 또는 무선접속을 공유하여 인터넷에 접속하는데 사용될 수 있다. PPPoE는 다이얼업 접속에서 흔히 사용되는 PPP와 근거리통신망에서 여러 명의 사용자들을 지원하는 이더넷 프로토콜이 결합된 것이다. PPP 프로토콜 정보는 이더넷 프레임 내에 캡슐화된다.
PPPoE는 전화회사와, 특별한 서비스를 제공해야 하는 ISP 모두에게 아무런 이점이 없다. 다이얼업 접속과는 달리, DSL과 케이블 모뎀은 항상 접속되어 있는 상태이다. 수 많은 사용자들이 물리적으로는 하나의 접속을 공유하고 있기 때문에, 서비스 제공업체의 입장에서는, 어떤 사용자에게 트래픽이 가야하며, 누구에게 대금을 청구해야 할지를 추적하는 방법이 필요하게 된다. PPPoE는 각 원격사이트가 각 사용자들의 네트웍 주소를 알 수 있도록 특별한 세션을 제공한다. 개개의 사용자와 원격지 사이트간에 세션이 연결되면, 그 세션은 대금청구 목적으로, 상태를 지속적으로 감시당할 수도 있다. 많은 아파트나 호텔 및 회사에서 현재, 인터넷을 이용하기 위해 이더넷과 PPoE 기술을 이용, DSL 회선을 공유하고 있다.
PPPoe란 무엇인지요?
PPPoe라는 것은 (point-to-point protocol over Ethernet)의 준말이라서 LAN,WAN의 상에 있는 곳과 인터넷망(원격지)을 연결하기 위한 규격입니다.
주로 사용하는 곳은 DSL 방식과 케이블 방식이 있으며, 한국에서는 PPPoe라는 자체를 케이블보다는 DSL방식에 적용을하고 있습니다. (물론 엄격하게 분류를 하면 케이블도 PPPoe방식이다.)
PPPoe의 장점이라고 하면 사무실,아파트,빌딩의 내의 모든 사용자들이 하나의 선을 가지고 접속을 통해서 인터넷을 접속하는데 공유 및 사용이 가능하다.
PPPoe는 PPP와 LAN에서의 통합을 이야기한다(앞에 한이야기를 축약) 원래 PPPoe는 항상 접속되어있는 상태로 유지가 되어야 하지만 국내에서는 비용 문제로 이렇게는 하지 않는다 PPPoe를 구현할때 처음에는 가장 큰문제점이 바로 PPPoe는 LAN(아파트,빌딩..)의 방식을 구현하기 때문에 그 원격지
장소에서 누가 쓰는지를 알 수가 없었다. 그래서 PPPoe에 별도의 세션을 추가 해서 이를 추적을 통해서 사용자의 네트웍주소를 알수 있도록 하게하였으며 이를 통해서 통신회사들은 각 사용자에 대한 정보를 정확하게 알수 있게 되었다.
PPP(Point-to-Point Protocol:P2P라고 도 불리우며 두개의 컴퓨터가 직렬이나 인터넷 전화선을 위해서 서로 다이렉트로 연결해서 데이터를 주고 받는 것을 의미하며, 여기서는 PC 와 서버간의 서로 주고받는 신호를 통해서 PC가 신호를 주면 서버가 응답을 해서 사용자의 PW,ID를 허가해주는 절차를 통해서 인터넷이 되는 것을 이야기 한다.)
(이러한 것은 SLIP라는 규격보다 발전된것으로 동기식 방식 뿐만아니라 비동기식 방식까지 포함되며, SLIP에서 가장 문제가 되었던 TCP/IP의 오류때 발생하는 손실 부분까지 하나의 켑을씌워서 오류 정정을 해결하였다.
동작확인을 위한 환경구축(PC 환경)
이제 실제 동작여부를 확인하기 위해 간단한 환경을 만들어보자. 준비물은 다음과 같다.
- PC 2 대(각각 우분투, 데비안이 설치되어 있다)
- 두 대의 PC 는 랜선으로 연결됨
- Server(Debian), Client(Ubuntu)
커널 설정
서버와 클라이언트 모두 PPPOE 를 사용하기 위한 커널 설정이 필요하다. PC 환경이라면, 설치 당시 기본 바닐라 커널에 PPPOE 관련 옵션이 이미 추가되어 있기 때문에 이 부분은 넘어가도 된다.
하지만, 임베디드 장비를 타겟으로 개발한다면, 커널 설정을 해주어야 한다. 추가해주어야 할 해당 커널 옵션의 위치는 다음과 같다.
Device Drivers ---> [*] Network device support ---> <M> PPP (point-to-point protocol) support <M> PPP over Ethernet (EXPERIMENTAL)
물론 아래 PPP 관련한 2개의 옵션을 (*)bulit-in 시켜도 무방하다. 오히려 더 간편한 방법이다. 위에서는 커널 이미지의 크기가 증가되는 것을 방지하기 위해 모듈로 선택하였다. 차후 커널 빌드 후에 드라이버 모듈 빌드가 완료되면, 총 4개의 모듈 파일(.ko)이 생성된다.
slhc.ko ppp_generic.ko pppox.ko pppoe.ko
insmod 실행 시, 위 파일의 순서대로 올려주어야 한다. 순서가 다르면, 심볼을 찾지 못해 로딩이 실패하게 된다.
서버 구축
먼저 아래와 같이 PPPOE 서버를 구축에 필요한 기본 프로그램을 설치한다.
#apt-get install ppp #apt-get install pppoe
이제 rp-pppoe 를 설치할 차례다.
http://www.roaringpenguin.com/products/pppoe 에서 rp-pppoe-3.11.tar.gz 를 다운받는다(2013/8/28 현재 최신버전). 압축을 풀고 빌드 후 설치한다.
#tar xzf rp-pppoe-3.11.tar.gz #cd rp-pppoe-3.11 #./go // configure, make, make install 까지 한번에 자동으로 해준다
설치 이후, 설정을 묻는다.
Welcome to the Roaring Penguin PPPoE client setup. First, I will run some checks on your system to make sure the PPPoE client is installed properly... Looks good! Now, please enter some information: USER NAME >>> Enter your PPPoE user name (default test): test // 입력 INTERFACE >>> Enter the Ethernet interface connected to the DSL modem For Solaris, this is likely to be something like /dev/hme0. For Linux, it will be ethn, where 'n' is a number. (default eth0): eth0 // 입력 Do you want the link to come up on demand, or stay up continuously? If you want it to come up on demand, enter the idle time in seconds after which the link should be dropped. If you want the link to stay up permanently, enter 'no' (two letters, lower-case.) NOTE: Demand-activated links do not interact well with dynamic IP addresses. You may have some problems with demand-activated links. >>> Enter the demand value (default no): no // 입력 DNS Please enter the IP address of your ISP's primary DNS server. If your ISP claims that 'the server will provide DNS addresses', enter 'server' (all lower-case) here. If you just press enter, I will assume you know what you are doing and not modify your DNS setup. >>> Enter the DNS information here: 8.8.8.8 // 입력 Please enter the IP address of your ISP's secondary DNS server. If you just press enter, I will assume there is only one DNS server. >>> Enter the secondary DNS server address here: 8.8.4.4 // 입력 PASSWORD >>> Please enter your PPPoE password: // test 입력 >>> Please re-enter your PPPoE password: // test 입력 FIREWALLING Please choose the firewall rules to use. Note that these rules are very basic. You are strongly encouraged to use a more sophisticated firewall setup; however, these will provide basic security. If you are running any servers on your machine, you must choose 'NONE' and set up firewalling yourself. Otherwise, the firewall rules will deny access to all standard servers like Web, e-mail, ftp, etc. If you are using SSH, the rules will block outgoing SSH connections which allocate a privileged source port. The firewall choices are: 0 - NONE: This script will not set any firewall rules. You are responsible for ensuring the security of your machine. You are STRONGLY recommended to use some kind of firewall rules. 1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation 2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway for a LAN >>> Choose a type of firewall (0-2): 0 // 입력 ** Summary of what you entered ** Ethernet Interface: eth0 User name: test Activate-on-demand: No Primary DNS: 8.8.8.8 Secondary DNS: 8.8.4.4 Firewalling: NONE >>> Accept these settings and adjust configuration files (y/n)? y // 입력 Adjusting /etc/ppp/pppoe.conf Adjusting /etc/resolv.conf Adjusting /etc/ppp/pap-secrets and /etc/ppp/chap-secrets (But first backing it up to /etc/ppp/pap-secrets-bak) (But first backing it up to /etc/ppp/chap-secrets-bak) Congratulations, it should be all set up! Type 'pppoe-start' to bring up your PPPoE link and 'pppoe-stop' to bring it down. Type 'pppoe-status' to see the link status.
클라이언트 구축
접속에 필요한 프로그램을 설치한다.
#apt-get install pppoeconf
서버 설정
다시 서버로 돌아와서 설정할 차례다. 설정 파일을 수정해야 하는데, 설정 파일은 /etc/ppp 디렉토리 아래에 있다.
pap-secrets
# Every regular user can use PPP and has to use passwords from * hostname "" * # UserIDs that cannot use PPP at all. Check your and add any # other accounts that should not be able to use pppd! guest hostname "*" - master hostname "*" - root hostname "*" - support hostname "*" - stats hostname "*" - # OUTBOUND connections # Here you should add your userid password to connect to your providers via # PAP. The * means that the password is to be used for ANY host you connect # to. Thus you do not have to worry about the foreign machine name. Just # replace password with your password. # If you have different providers with different passwords then you better # remove the following line. # * password "test" * "test" // 추가
pppoe-server-options
# PPP options for the PPPoE server # LIC: GPL #require-pap // 주석 require-chap // 추가 #login // 주석 lcp-echo-interval 10 lcp-echo-failure 2
chap-secrets
# Secrets for authentication using CHAP # client server secret IP addresses "test" * "test" * // 추가
pppoe-up 스크립트 파일 생성
이제 실행을 위한 스크립트를 만들어줄 차례다.
#touch /usr/local/bin/pppoe-up #chmod 777 /usr/local/bin/pppoe-up
다음과 같이 작성한다.
#!/bin/bash # ---------------------------------------------------- # Starts the PPPoE server and turns on NAT # ---------------------------------------------------- # MAX is the maximum number of addresses your server # is allowed to hand out. PROV=pppoe MAX=5 # BASE is the lowest IP address your server is allowed # to hand out. #BASE=192.168.1.238 #PLA=192.168.1.0/24 BASE=10.10.220.2 PLA=10.10.220.0/8 # NAT is the set of addresses which your server will # NAT behind it. Other addresses behind your server # WILL NOT be NATed. #NAT=10.10.220.0/8 # MYIP is the public IP address of this server. MYIP=10.10.220.1 ########################################## # Here is where the script actually starts executing. ########################################## # Disable IP spoofing on the external interface. #/sbin/iptables -A INPUT -i eth0 -s $NAT -j DROP # Enable NAT for the private addresses we hand out. #/sbin/iptables -t nat -A POSTROUTING -s $NAT -j $NAT --to-source $MYIP # Launch the server. /usr/sbin/pppoe-server pty -T 60 -I eth0 -L $MYIP -N $MAX -C $PROV -S $PROV -R $PLA #echo "1" > "/proc/sys/net/ipv4/ip_forward"
동작확인 하기(PC 환경)
이제 서버와 클라이언트 모두 설정이 끝났다. 제대로 동작하는지 확인을 해보자. 먼저 서버를 실행한다.
#pppoe-up
이제 클라이언트 쪽을 실행할 차례다.
#pppoeconf
실행하면, PPPOE 서버를 찾는 과정(scan)이 시작된다. 찾았으면, 몇가지 설정을 묻는다.
>Continue with configuration? -> Y >Should I check your configuration file and change these settings where neccessary? -> Y >ENTER USERNAME -> test >ENTER PASSWORD -> test >USE PEER DNS -> Y >LIMITED MSS PROBLEM -> Y >Would you like to start the connection at boot time? -> N >ESTABLISH A CONNECTION -> Y >CONNECTION INITIATED -> Y
위 질문에 답을 하면, 아래와 같이 메세지가 출력되면서, 접속 시도를 한다.
Plugin rp-pppoe.so loaded.
접속이 성공적으로 진행되었는지 여부는 로그를 통해 알 수 있다. 두가지 방법이 있는데, 첫번째 방법은 /var/log/syslog 파일을 보는 것이다.
Aug 28 09:54:14 debian pppoe-server[5208]: Session 1 created for client 00:26:66:4f:d4:cd (10.10.220.0) on eth0 using Service-Name '' Aug 28 09:54:14 debian pppd[5208]: pppd 2.4.5 started by root, uid 0 Aug 28 09:54:14 debian pppd[5208]: Using interface ppp0 Aug 28 09:54:14 debian pppd[5208]: Connect: ppp0 <--> /dev/pts/1 Aug 28 09:54:18 debian kernel: [ 3723.740307] PPP BSD Compression module registered Aug 28 09:54:18 debian kernel: [ 3723.771004] PPP Deflate Compression module registered Aug 28 09:54:18 debian pppd[5208]: local IP address 10.10.220.1 Aug 28 09:54:18 debian pppd[5208]: remote IP address 10.10.220.0
다른 한가지 방법은 plog 라는 명령어다.
#plog Aug 28 09:54:14 debian pppd[5208]: pppd 2.4.5 started by root, uid 0 Aug 28 09:54:14 debian pppd[5208]: Using interface ppp0 Aug 28 09:54:14 debian pppd[5208]: Connect: ppp0 <--> /dev/pts/1 Aug 28 09:54:18 debian pppd[5208]: local IP address 10.10.220.1 Aug 28 09:54:18 debian pppd[5208]: remote IP address 10.10.220.0
위 로그들을 보면, 성공적으로 접속이 되었고, 로컬과 원격의 IP 주소가 할당된 것을 볼 수 있다.
서버 쪽에서 ifconfig 를 실행하면 222.1 이 할당되었고,
#ifconfig ppp0 ppp0 Link encap:Point-to-Point Protocol inet addr:10.10.220.1 P-t-P:10.10.220.0 Mask:255.255.255.255 // 클라이언트 쪽의 IP 가 적혀있다 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 RX packets:784 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:52939 (51.6 KiB) TX bytes:85 (85.0 B)
클라이언트 쪽에서 ifconfig 를 실행하면, 아래와 같이 222.0 이 할당된 것을 볼 수 있다.
ppp0 Link encap:Point-to-Point Protocol inet addr:10.10.220.0 P-t-P:10.10.220.1 Mask:255.255.255.255 // 서버 쪽의 IP 가 적혀있다 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 RX packets:784 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:52939 (51.6 KiB) TX bytes:85 (85.0 B)
이후 서로 ping 을 실행하여 마지막으로 연결 성공을 확인하자.
동작확인을 위한 환경구축(타겟 환경)
앞서 설명한 PC 환경에서의 방법은 직접 소스(tarball)로 설치하지 않았기 때문에 상대적으로 간단했다. 이제 설명할 임베디드 환경에서의 포팅 및 동작 방법은 조금더 복잡하다.
타겟은 클라이언트로만 동작하기 때문에, 서버의 구축 및 설정 방법은 앞서 PC 환경과 동일하다. 따라서 클라이언트 부분만 달라진다고 보면 된다.
준비운동 하기
PPP 포팅
ppp 를 다운 받아야 한다. http://ppp.samba.org/download.html 에서 받을 수 있는데, 현재 최신버전이 2.4.5 이다. 하지만, 릴리즈 날짜를 보면, 2009년 11월 이다. 이후 삽질을 통해서 알게된 사실이지만, 이 버전은 여러가지 버그가 많이 존재한다. 따라서 FTP 로 받지 말고, rsync 로 받기를 추천한다.
이는 계속 버그가 수정되고 있는 개발 버전이다.
아래와 같이 /tmp/ppp 디렉토리 아래에 다운 받는다.
#rsync -avz rsync://cvs.samba.org/ftp/unpacked/ppp/ /tmp/ppp
이제 빌드해보자!
#cd /tmp/ppp #./configure #CC=/home/sungho/opt/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-gcc make
설정하기
별다른 에러없이 빌드되었다면, 필요한 파일들을 파일시스템에 복사한다.
#cp pppd/pppd /home/wjkim/s1_filesys/filesys_wifi/rdk4_1_nocompression/srv/wifi/ #mkdir -p /home/wjkim/s1_filesys/filesys_wifi/rdk4_1_nocompression/usr/local/lib/pppd/2.4.5/ #cp pppd/plugins/rp-pppoe/rp-pppoe.so /home/wjkim/s1_filesys/filesys_wifi/rdk4_1_nocompression/usr/local/lib/pppd/2.4.5/ #mkdir -p /home/wjkim/s1_filesys/filesys_wifi/rdk4_1_nocompression/etc/ppp/peers
이제 설정 파일들을 만들어 줄 차례다.
필요한 파일은 총 3개인데, /etc/ppp/chap-secrets, /etc/ppp/pap-secrets, /etc/ppp/peers/dsl-provider 이다.
/etc/ppp/chap-secrets
# Secrets for authentication using CHAP # client server secret IP addresses "test" * "test"
/etc/ppp/pap-secrets
# other accounts that should not be able to use pppd! guest hostname "*" - master hostname "*" - root hostname "*" - support hostname "*" - stats hostname "*" - # OUTBOUND connections # Here you should add your userid password to connect to your providers via # PAP. The * means that the password is to be used for ANY host you connect # to. Thus you do not have to worry about the foreign machine name. Just # replace password with your password. # If you have different providers with different passwords then you better # remove the following line. # * password "test" * "test"
/etc/ppp/peers/dsl-provider
# Minimalistic default options file for DSL/PPPoE connections noipdefault defaultroute #replacedefaultroute hide-password #lcp-echo-interval 30 #lcp-echo-failure 4 noauth persist #mtu 1492 #persist #maxfail 0 #holdoff 20 plugin rp-pppoe.so eth0 usepeerdns user "test"
동작확인 하기(타겟 환경)
서버에서 먼저 pppoe-up 을 실행하고, 타겟에서는 아래와 같이 실행한다.
#cd /srv/wifi #./pppd call dsl-provider
이제 서버쪽에서 로그를 확인하자.
FAQ
pppd 의 참조 파일 경로를 변경하기 위해서는 어디를 수정해야 하는가
pppd/pathnames.h 파일을 아래와 같이 수정하면 된다.
/* * define path names * * $Id: PPPOE,v 1.41 2013/10/08 01:07:49 root Exp root $ */ #ifdef HAVE_PATHS_H #include <paths.h> #else /* HAVE_PATHS_H */ #ifndef _PATH_VARRUN #define _PATH_VARRUN "/tmp/" #endif #define _PATH_DEVNULL "/dev/null" #endif /* HAVE_PATHS_H */ #ifndef _ROOT_PATH #define _ROOT_PATH #endif #define _PATH_UPAPFILE _ROOT_PATH "/tmp/pap-secrets" #define _PATH_CHAPFILE _ROOT_PATH "/tmp/chap-secrets" #define _PATH_SRPFILE _ROOT_PATH "/tmp/srp-secrets" #define _PATH_SYSOPTIONS _ROOT_PATH "/tmp/options" #define _PATH_IPUP _ROOT_PATH "/tmp/ip-up" #define _PATH_IPDOWN _ROOT_PATH "/tmp/ip-down" #define _PATH_IPPREUP _ROOT_PATH "/tmp/ip-pre-up" #define _PATH_AUTHUP _ROOT_PATH "/tmp/auth-up" #define _PATH_AUTHDOWN _ROOT_PATH "/tmp/auth-down" #define _PATH_TTYOPT _ROOT_PATH "/tmp/options." #define _PATH_CONNERRS _ROOT_PATH "/tmp/connect-errors" #define _PATH_PEERFILES _ROOT_PATH "/tmp/" #define _PATH_RESOLV _ROOT_PATH "/etc/resolv.conf" #define _PATH_USEROPT ".ppprc" #define _PATH_PSEUDONYM ".ppp_pseudonym" #ifdef INET6 #define _PATH_IPV6UP _ROOT_PATH "/tmp/ipv6-up" #define _PATH_IPV6DOWN _ROOT_PATH "/tmp/ipv6-down" #endif #ifdef IPX_CHANGE #define _PATH_IPXUP _ROOT_PATH "/tmp/ipx-up" #define _PATH_IPXDOWN _ROOT_PATH "/tmp/ipx-down" #endif /* IPX_CHANGE */ #ifdef __STDC__ #define _PATH_PPPDB _ROOT_PATH _PATH_VARRUN "pppd2.tdb" #else /* __STDC__ */ #ifdef HAVE_PATHS_H #define _PATH_PPPDB "/tmp/pppd2.tdb" #else #define _PATH_PPPDB "/tmp/pppd2.tdb" #endif #endif /* __STDC__ */ #ifdef PLUGIN #ifdef __STDC__ #define _PATH_PLUGIN DESTDIR "/lib/pppd/" VERSION #else /* __STDC__ */ #define _PATH_PLUGIN "/usr/lib/pppd" #endif /* __STDC__ */ #endif /* PLUGIN */
어떻게 연결을 유지하는가(자동 재접속)
ADSL이 한번 연결되면 연결이 끊기지 않도록 해주는 방법을 여러 곳에서 제시하고 있으나 별로 권하고 싶지 않다. 쓰지 않으면서 연결을 계속 유지한다면 다른 사용자의 사용에 지장을 주는 결과가 되기 때문이다. 리눅스에서 일정 간격으로 한국통신의 ppp 서버에 ping을 쏘는 방법도 회선 장애로 인한 끊김에는 효과가 없다. 끊김을 방지하는 방법은 별 실효가 없고 오히려 끊겼을 때 재연결해 주는 방식이 의미가 있다. 이때는 끊겼다는 사실을 어떻게 확인하는가가 중요한데 ifconfig 에서 ppp0를 확인하는 것도 확실한 방법이 아니다. 리눅스에 다른 PPP 연결이 있다면 ppp0 가 ADSL 연결이라는 보장이 없다.
ppp 옵션 중에 아래의 항목이 있다.
lcp-echo-interval 90 lcp-echo-failure 2
위 둘은 끊김을 방지하는 옵션이 아니라 ppp 연결이 끊겼는데도 ppp 데몬(즉 ppp0)가 계속 살아 있어서 재연결에 지장을 주지 않기 위해 필요하다. 즉 90초 간격으로 2 번 lcp-echo 패킷을 보냈는데도 상대에게서 응답이 없으면 ppp 연결을 종료하라는 뜻이다.
이부분을 ppp 옵션에 넣으면 데비안의 경우 /var/log/daemon.log 에 90초 간격으로 아래 2개의 라인이 나타난다.
May 22 15:28:05 gtoys pppd[101]: sent [LCP EchoReq id=0x1b magic=0xfebb0c97] May 22 15:28:05 gtoys pppd[101]: rcvd [LCP EchoRep id=0x1b magic=0xf6386cd]
첫 번 라인은 리눅스에서 한국통신 서버에 보낸 응답 요청 패킷이고 (즉 너 살아 있니?) 아래는 한국통신 서버에서의 답장이다.( 나 잘 있다.) 선 연결이 끊기거나 한국통신의 서버가 다운되면 2번째 라인이 나타나지 않는다. 90초 후 다시 응답 요청 패킷을 리눅스에서 보내도 한국통신 서버가 회신을 않으면 그 때는 PPP 데몬이 죽는다.
따라서 끊김을 확실히 아는 방법은 위의 PPP 옵션을 넣고 ps ax 명령에서 “pppd /dev/pppox0 38400” 라인이 있는지 체크하는 것이다.
끊김을 확인하고 자동으로 재 연결하는 방법은 아래의 방법이 가능할 것 같다.
- cron 으로 일정 시간마다 확인하는 방법(끊김 확인은 “ps ax” 명령을 쓰는게 낫다.)
- /etc/ppp/ip-down 스크립트를 사용하는 방법 : ip-down 은 ppp 연결이 끊길 때 실행되는 명령이므로 가장 확실하다. 단 회선이 물리적으로 절단되면 ip-down 에서 재 연결 명령을 주어도 소용 없다. 이에 대한 대비가 필요하다.
<참고> pppoed-0.47/contribs 디렉토리에 ppp 연결이 ADSL 하나일 경우 ppp 자동 재연결 스크립트가 있다. 아래가 그 내용이다.( 파일명이 keepalive.ppp 임) 이 스크립트를 부팅 시 자동으로 실행되도록 한다.(pppoed가 위치한 /usr/local/sbin 디렉토리가 “export PATH=” 에 지정되어야 한다.)
#!/bin/sh # restart the ppp connection whenever it goes down export PATH=/bin:/usr/bin:/sbin:/usr/local/sbin export LOG="logger -p daemon.notice -t `basename $0`[$$]" $LOG "Monitoring PPP connection" while [ 1 ] do if `ifconfig | grep -q ^ppp0` then $LOG "PPP connection ok" else $LOG "Starting pppoed" pppoed fi sleep 60 done
부팅시 자동으로 PPPOE 관련 모듈 로딩하기
파일시스템의 ipnc/load_module.sh 파일을 아래와 같이 수정한다.
mknod /dev/relay c 256 1 mknod /dev/sensor c 255 1 insmod relay.ko insmod sensor.ko mknod /dev/adc c 257 1 mknod /dev/rear c 258 1 insmod adc.ko insmod rear.ko insmod cfg80211.ko insmod lib80211.ko insmod lib80211_crypt_ccmp.ko insmod lib80211_crypt_tkip.ko insmod lib80211_crypt_wep.ko insmod mac80211.ko insmod slhc.ko // 추가 insmod ppp_generic.ko // 추가 insmod pppox.ko // 추가 insmod pppoe.ko // 추가