クリックして読む:ブロードバンド、ナローバンド、ADSL、PPPoE、仮想ダイヤルアップなどの用語解説
当初、仮想マシンに Red Hat を初めてインストールしたとき、百度で何度も Google し、数え切れないほどのフォーラムやブログを巡り、たくさんの投稿や記事を読み、いろいろな方法を試しました。それでも、どうしても「ブロードバンド」をインターネットにつなぐ方法が見つかりませんでした。
その後 Ubuntu を使ったときも同じでした。Ubuntu 標準のクライアントではまったくインターネットに接続できず、方法を探しても、見かける回答は的外れなものが多く、本当に気が滅入りました。
Linux の各種ディストリビューションではコマンドはおおむね共通していますが、一部には違いもあります。以下では、一般的なディストリビューションで PPPoE/ADSL の仮想ダイヤルアップを設定するときに使うコマンドを整理します。ディストリビューションやバージョンによる差が大きいため、パッケージ名、パス、ネットワークカード名は自分の環境に合わせて確認してください。作業前に ip link でネットワークカード名を確認し、ディストリビューションのパッケージマネージャーで rp-pppoe または対応する PPPoE クライアントがインストール済みか確認しておくとよいでしょう。
Table of Contents
Red Hat Linux
Red Hat Linux では、ADSL モデム関連のコマンドがよく使われます。これはブロードバンドモデムの動作を設定するためのものです。
まず PPPoE ソフトウェアがインストールされているか、また必要なバージョンを満たしているか確認します。古い資料では、3.5-1 より新しいバージョンが必要とされていることがよくあります。バージョンが低すぎる場合は、たとえば rp-pppoe-3.5-3.i386.rpm のようなパッケージで先にアップグレードできます。
rpm -Uvh rp-pppoe-3.5-3.i386.rpm
補足:私は、アップグレードは必須ではないと思います。どうしてもアップグレードする場合は、別のコンピューターで適切な PPPoE パッケージをダウンロードし、/home/あなたのユーザー名/ の下に置いてから、上のコマンドを実行すればよいです。コマンドの大文字小文字に注意し、ファイル名も実際にダウンロードしたものに置き換えてください。
インストール後、通常は次の 4 つのコマンドが提供されます。
adsl-setup:DNS、ユーザーアカウント、パスワード、その他のオプションを設定します。adsl-start:ADSL でインターネットに接続します。adsl-stop:ADSL とインターネット接続を切断します。adsl-status:ADSL 接続状態を確認します。
ADSL 接続を作成します。
[root@sample ~]# adsl-setup
Welcome to the ADSL client setup. First, I will run some checks on
your system to make sure the PPPoE client is installed properly...
LOGIN NAME
Enter your Login Name (default root):
ここには ADSL 接続のユーザー名を入力します。
INTERFACE
Enter the Ethernet interface connected to the ADSL modem
For Solaris, this is likely to be something like /dev/hme0.
For Linux, it will be ethX, where 'X' is a number.
(default eth0):
ここではネットワーク接続デバイスを指定します。ネットワークカードが 1 枚だけの場合は、通常デフォルトの eth0 を使います。比較的新しいシステムでは eth0 という名前ではないことがあるため、ip link の出力に基づいて実際のネットワークカード名を入力してください。
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):
そのまま Enter を押し、デフォルト設定を受け入れます。
DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide dynamic 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:
DNS サーバーのアドレスが分かる場合はここに入力します。分からない場合は Enter を押してスキップできます。古い資料では「全国 DNS サーバー IP アドレス」のダウンロード先として、次の URL が紹介されていました:http://olseeling.qjwm.com/down_1249888.html。
PASSWORD
Please enter your Password:
Please re-enter your Password:
ADSL 接続パスワードを入力し、確認のため再入力します。
USERCTRL
Please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop DSL connection (default yes): no
no と入力し、一般ユーザーが PPPoE 接続を制御できないようにします。
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 と入力し、ここではファイアウォールを使用しないことを示します。
Start this connection at boot time
Do you want to start this connection at boot time?
Please enter no or yes (default no): yes
yes と入力し、システム起動時に ADSL へ自動接続するようにします。
** Summary of what you entered **
Ethernet Interface: eth0
User name: caun870293@ca.dti.ne.jp
Activate-on-demand: No
DNS: Do not adjust
Firewalling: NONE
User Control: no
Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
(But first backing it up to /etc/ppp/chap-secrets.bak)
(But first backing it up to /etc/ppp/pap-secrets.bak)
Congratulations, it should be all set up!
Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.
設定内容に間違いがなければ、y と入力して設定を確定します。
ADSL 接続を開始します。
adsl-start
しばらく待ち、起動に成功すると、通常はそのままコマンドプロンプトに戻ります。追加メッセージがなくても接続成功を意味する場合があります。次のコマンドでも確認できます。
adsl-status
ip addr show ppp0
route -n
Ubuntu
- アプリケーションメニューを開き、「アクセサリ」->「端末」の順に選択します。
- 端末ウィンドウで次のように入力します。
sudo pppoeconf
- 現在の Ubuntu 管理者ユーザーのパスワード入力を求められます。入力後、Enter を押します。
- ネットワークデバイスについて尋ねられたら、通常は「はい」を選んでプログラムに検出させ、その後も続けて「はい」を選びます。
- その後、ADSL のユーザー名とパスワードの入力を求められます。アカウントを入力するときは、元の
userを削除してから自分のアカウントを入力します。パスワード以外の質問は、通常すべて「はい」(Yes)で問題ありません。 - 最後に、起動時に自動ダイヤルするかどうかを尋ねられます。「はい」(Y)を選ぶと、デフォルトでは起動時に確認なしで自動ダイヤルし、そのままインターネットを利用できます。「いいえ」(N)を選んだ場合は、接続が必要なときに手動で端末を開き、次のように入力します。
sudo pon dsl-provider
よく使うコマンドは次のとおりです。
pon:ADSL 接続を有効にします。poff:ADSL 接続を終了します。plog:ADSL のメッセージを確認します。デバッグ時に使用します。ifconfig ppp0:ppp0インターフェースがあるか確認します。比較的新しいシステムではip addr show ppp0も使えます。route -n:デフォルトゲートウェイが正しいか確認します。nslookup:DNS が正しく名前解決できるか確認します。
これらのコマンドは、ADSL でインターネット接続するときに発生する問題の解決に役立ち、ADSL 接続のデバッグにも使えます。
CentOS
Red Hat Linux と同じです。
BackTrack Linux
Red Hat Linux と同じです。
Slax
Red Hat Linux と同じです。
