[네트워크] 하나로ADSL+매스크레딩 구축하기

환경 : 하나로 ADSL lite

SpeedWarp HD3100 (외장형 모뎀)

PC#1 : 펜티엄 133 , 램 64메가, 하드디스크 1기가 , 와우리눅스 7.0 까치

PC#2 : 셀러론 600 , 램 256메가,하드디스크 40기가, 윈도우 2000

Lan card : 리얼텍 RTL8139 3장

목적 : PC#1에 리눅스를 설치하고 ADSL 을 설정한 후,

마스커레이딩을 이용하여 PC#2에서도 원활히 인터넷을 사용한다.

방법 :

1. PC#1에 리눅스를 설치한다.

제 경우에는 하드디스크 용량이 부족해서 한컴리눅스 2.2 나 미지리눅스 2.0은

설치할 수 가 없더군요. 그래서 선택한 것이 와우리눅스 7.0

2. rp-pppoe 와 ppp 패키지를 설치한다.

와우리눅스 7.0 까치에는 rp-pppoe-2.5-1 과 ppp-2.3.11-7 이 들어있는데,

ADSL 이 특성을 타는지 잘 동작하지 않았습니다.

그래서 한컴 2.2 배포판에 들어있는 rp-pppoe-3.31hl 와 ppp-2.4.1-2hl 를

설치하였습니다. 잘~ 되더군요.

이하의 설명은 와우리눅스 홈페이지의 정보광장에 있는 내용입니다.

아주 훌륭히 설명되어 있기 때문에 대부분 그대로 옮깁니다.

다만, 한두가지 설정이 잘못 된 부분만 수정하도록 하겠습니다.

차 례

1. 클라이언트로 이용시

2. standalone 사용시

3. 매스커레이딩 사용시

4. 필자의 사용사례

1. 클라이언트로 이용시 (랜카드가 하나이고, 직접 연결하여 사용할 경우)

1-1. 리눅스 설치

리눅스 설치시 랜카드 방식을 물어볼 때 (클라이언트로 사용, 매스커레이딩 사용하지 않

음) DHCP가 아닌 고정아이

피를 준다.(192.168.0.1) 그 다음 모든 설치가 끝나고 리부팅을 시킨다.

1-2. ADSL Setup

한텀 혹은 콘솔에서

# adsl-setup

을 실행한다.

Welcome to the Roaring Penguin ADSL 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 alponce): <= 여기에 하나로 아이디를



어 줍니다.

ex) userid@hanaro

INTERFACE

>>> Enter the Ethernet interface connected to the ADSL modem

(default eth1):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): <= 그냥 엔터를 치면 됩니다…

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:210.220.163.82 <= 하나로 DNS를 넣어

줍니다..

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: 210.94.6.67 <= 보조 DNS입니

다.

PASSWORD

>>> Please enter your PPPoE password: <= 패스워드를 넣어 줍니다..

>>> Please re-enter your PPPoE password: <= 다시 한번 넣어 줍니다…

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 <= 일단 0을 선택합니다.

** Summary of what you entered **

Ethernet Interface: eth0

User name: userid@hanaro

Activate-on-demand: No

Primary DNS: 168.126.63.1

Secondary DNS: 168.126.63.2

Firewalling: STANDALONE

>>> 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)

1-3. 파일의 편집

여기까지 한 다음 몇가지 파일을 편집하여야 합니다.

/etc/ppp/pppoe.conf 파일의 설정을 수정합니다. 하나로 ADSL을 rp-pppoe 패키지로

접속하기 위해서는 옵션이 한

가지 추가되어야 합니다. 이 옵션이 없으면, 접속이 안될 수도 있습니다.

/etc/ppp/pppoe.conf 파일의 끝에 보면 다음과 같은 부분이 보입니다.

# Any extra arguments to pass to pppoe. Normally, use a blank string

# like this:

PPPOE_EXTRA=””

여기에서,

PPPOE_EXTRA=”-S pppoe”

라고 써줍니다. 대소문자를 구분하니 주의하시기 바라구요.

마지막으로

# adsl-start

라고 입력하세요.

그러면, 연결되었다고 나올 것입니다.

2. standalone 사용시 (랜카드가 하나이고 직접 연결하여 사용할 경우)

2-1. 파이어월의 설정

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 <= 1일 경우…

여기서 1이나 2를 선택한 사람은 파이어월 설정파일을 생성해야 합니다. 이 문서에 딸려

있는 firewall-standalone 파

일을 그대로 사용하셔두 무방하구요. 아니면 다음의 파일을 만드셔두 됩니다.

이 파일은 /etc/rc.d/init.d 밑에 firewall이라는 이름으로 위치해야 합니다.

#!/bin/sh

#

# firewall-standalone This script sets up firewall rules for a standalone

# machine

#

# Copyright (C) 2000 Roaring Penguin Software Inc. This software may

# be distributed under the terms of the GNU General Public License, version

# 2 or any later version.

# Interface to Internet

EXTIF=ppp+

ANY=0.0.0.0/0

ipchains -P input ACCEPT

ipchains -P output ACCEPT

ipchains -P forward DENY

ipchains -F forward

ipchains -F input

ipchains -F output

# Deny TCP and UDP packets to privileged ports

ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p udp -j DENY

ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p tcp -j DENY

2-2. 실행

그 다음은 당연히

#adsl-start

를 실행시키면 연결이 됩니다.

3. 매스커레이딩 사용시

랜카드가 하나 이상이고, eth0가 외부와 연결되고 eth1이 내부에 연결 <== 요것이 제가

구성할 환경.

eth0 : 192.168.0.1

eth1 : 192.168.1.1 (eth0 와 eth1 이 서로 다른 서브넷에 위치하도록 설정)

3-1. 네트워크 카드 설정

INTERFACE

>>> Enter the Ethernet interface connected to the ADSL modem

(default eth1):eth0 <= eth0 이 ADSL 외장모뎀과 연결

3-2. 파이어월의 설정

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 <= 2일 경우…

여기서, 2를 선택한 사람은 파이어월 설정파일을 생성해야 합니다.

이 문서에 딸려있는 firewall-masq 파일을 그대로 사용하셔두 무방하구요… 아니면 다음

의 파일을 만드셔두 됩니다.

이 파일은 /etc/rc.d/init.d 밑에 firewall 이라는 이름으로 위치해야 합니다.

#!/bin/sh

#

# firewall-masq This script sets up firewall rules for a machine

# acting as a masquerading gateway

#

# Copyright (C) 2000 Roaring Penguin Software Inc. This software may

# be distributed under the terms of the GNU General Public License, version

# 2 or any later version.

# Interface to Internet

EXTIF=ppp+

ANY=0.0.0.0/0

ipchains -P input ACCEPT

ipchains -P output ACCEPT

ipchains -P forward DENY

ipchains -F forward

ipchains -F input

ipchains -F output

# Deny TCP and UDP packets to privileged ports

ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p udp -j DENY

ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p tcp -j DENY

# Deny TCP connection attempts

ipchains -A input -l -i $EXTIF -p tcp -y -j DENY

# Deny ICMP echo-requests

ipchains -A input -l -i $EXTIF -s $ANY echo-request -p icmp -j DENY

# Do masquerading

ipchains -A forward -j MASQ

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

[주의] ipchains -A input -l -i $EXTIF -d $ANY 0:1023 -p udp -j DENY

에서 input 다음의 옵션은 소문자 L입니다.

3-3. 실행

그 다음은 당연히

# adsl-start

를 실행시키면 연결이 됩니다.

3-4. 매스커레이팅 머신에 물린 클라이언트 설정

클라이언트 들의 IP 주소는 192.168.1.2~254 중 아무거나 쓰시면 됩니다.

리눅스 머신에 물린 다른 머신들의 네임서버는 리눅스머신에 네임서버가 설치되어 있다

면 리눅스머신으로 잡아 주

면(192.168.1.1) 됩니다. 만일 네임서버가 설치되지 않았다면 하나로 네임서버

(210.220.163.82)을 잡아주면 됩니다

. 클라이언트에서 게이트웨이는 클라이언트와 연결된 서버 랜카드의 IP로 지정해 줍니

다. (192.168.1.1) ADSL로 연

결되는 리눅스 머신에서는 게이트웨이를 설정할 필요가 없습니다.

4. 필자의 사용사례

ADSL —- lan card [ PC#1 ] lan_card —— lan_card [ PC#2 ]

192.168.0.1 192.168.1.1 192.168.1.2

adsl-start 이전의 라우팅 테이블은 아래와 같고,

[root@onesarts init.d]# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.1.0 * 255.255.255.0 U 0 0 0 eth1

192.168.0.0 * 255.255.255.0 U 0 0 0 eth0

127.0.0.0 * 255.0.0.0 U 0 0 0 lo

adsl-start 이후의 라우팅 테이블은 아래와 같습니다.

[root@onesarts init.d]# route

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

211.108.29.1 * 255.255.255.255 UH 0 0 0 ppp0

192.168.1.0 * 255.255.255.0 U 0 0 0 eth1

192.168.0.0 * 255.255.255.0 U 0 0 0 eth0

127.0.0.0 * 255.0.0.0 U 0 0 0 lo

default 211.108.29.1 0.0.0.0 UG 0 0 0 ppp0

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

1 Response

  1. cozy winter jazz 말해보세요:

    cozy winter jazz

페이스북/트위트/구글 계정으로 댓글 가능합니다.