본문 바로가기

참 오래된 기술이다.

이런걸 정리해 놓은 게 있으려나..........있지.

간단히 국산블로그에서도

리눅스에 PPPoE 서버 구축하기


해외 블로그 에서도

http://www.howtodoityourself.org/pppoe-server-how-to-do-it-yourself.html


간단히 옮겨보자꾸나.


1. Make sure you have an active internet connection. If not, set it up by using your favorite text editor (I use vim):

vim /etc/network/interfaces 
auto lo
iface lo inet loopback

iface eth0 inet static
address 89.xxx.yyy.zzz     #Your public IP address
netmask 255.255.255.240  #Your subnet mask
gateway 89.xxx.xxx.xxx    #Your gateway

iface eth1 inet static
address 192.168.1.254
netmask 255.255.255.0

Set up one or more nameservers (I use the free ones provided by Google):

echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf

Ping some website to make sure your internet connection is working:

cristian@desktop:~$ ping google.com
PING google.com (209.85.229.147) 56(84) bytes of data.
64 bytes from ww-in-f147.1e100.net (209.85.229.147): icmp_req=1 ttl=52 time=83.0 ms

2. Install ppp daemon:

sudo apt-get install ppp

3. Now get rp-pppoe from here.

wget http://www.roaringpenguin.com/files/download/rp-pppoe-3.10.tar.gz

And extract it

 tar -zxvf  rp-pppoe-3.10.tar.gz

Now compile it

cd rp-pppoe-3.10/src/
./configure
make && make install

4. Now, we shall edit the PPPoE server options:

vim /etc/ppp/pppoe-server-options
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
netmask 255.255.255.0
defaultroute
noipdefault
usepeerdns

5. Add usernames and passwords:

vim /etc/ppp/chap-secrets

# Secrets for authentication using CHAP # client server secret IP addresses #USERNAME SERVER PASSWORD CLIENT IP ADDRESS "사용자이름" * "비밀번호" 192.168.1.1

6. Set up the IP addresses pool:

echo "192.168.1.1-20" > /etc/ppp/allip

This will assign the future clients one IP address from the 192.168.1.1 until 192.168.1.20 range.

7. Start the PPPoE server:

pppoe-server -C isp -L 192.168.1.254 -p /etc/ppp/allip -I eth1

8. Enable packet forwarding between network interfaces:

echo 1 > /proc/sys/net/ipv4/ip_forward

9. Set up NAT in order to provide internet access to the LAN computers:

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

클라이언트 구성 및 설명은 위에 언급한 한글 사이트에서


타깃 보드에 연결 설정을 합니다.

 

 # cat > tee /etc/ppp/options << "EOF"
 plugin rp-pppoe.so
 eth0
 defaultroute
 usepeerdns
 user "test"
 noauth
 noipdefault
 hide-password
 debug
 EOF

 

 # cat << "EOF" | tee -a /etc/ppp/chap-secrets > /dev/null 2>&1
 "test" * "test" *
 EOF

 

다음과 같이 ppp 데몬을 실행하면 접속이 된 것을 확인하실 수 있습니다.

 

 # pppd
 Plugin rp-pppoe.so loaded.
 RP-PPPoE plugin version 3.8p compiled against pppd 2.4.5
 # ifconfig
 eth0      Link encap:Ethernet  HWaddr 12:34:56:78:90:AA  
           inet6 addr: fe80::1034:56ff:fe78:90aa/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:43 errors:0 dropped:0 overruns:0 frame:0
           TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:4429 (4.3 KiB)  TX bytes:4018 (3.9 KiB)
           Interrupt:33
 
 lo        Link encap:Local Loopback  
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0 
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
 ppp0      Link encap:Point-to-Point Protocol  
           inet addr:192.168.1.1  P-t-P:192.168.1.254  Mask:255.255.255.255
           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
           RX packets:4 errors:0 dropped:0 overruns:0 frame:0
           TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:3 
           RX bytes:76 (76.0 B)  TX bytes:70 (70.0 B)
 
 # ping 192.168.1.254
 PING 192.168.1.254 (192.168.1.254): 56 data bytes
 64 bytes from 192.168.1.254: seq=0 ttl=64 time=26.023 ms
 64 bytes from 192.168.1.254: seq=1 ttl=64 time=23.892 ms
 64 bytes from 192.168.1.254: seq=2 ttl=64 time=22.464 ms
 64 bytes from 192.168.1.254: seq=3 ttl=64 time=21.808 ms
 
 --- 192.168.1.254 ping statistics ---
 4 packets transmitted, 4 packets received, 0% packet loss
 round-trip min/avg/max = 21.808/23.546/26.023 ms


B로그0간

개발 관련 글과 유용한 정보를 공유하는 공간입니다.