找回密碼
 註冊
[日本手機遊戲APPS下載] 手機遊戲專區 熱門短片

型男索女 
查看: 914|回復: 3

[自改Router系列] 係Debian/Ubuntu到起Router

[複製鏈接]
發表於 2-1-2012 14:25:32 | 顯示全部樓層 |閱讀模式
本帖最後由 hixyz111 於 2-1-2012 16:34 編輯

唔會教點裝Debian or Ubuntu,自己爬Google

先整個network diagram

要有Switch*1/LAN Card * 2/Wifi-AP *1

準備工作:
Ubuntu 11.04/11.10

  1. In Terminal:
  2. 1. sudo nano /etc/sysctl.conf
  3. 2. 改net.ipv4.ip_forward=1
  4. 3. save
  5. 4. sudo sysctl -p
複製代碼
Debian

  1. su --login (變成root)
  2. nano /etc/sysctl.conf
  3. 改net.ipv4.ip_forward=1
  4. sysctl -p
複製代碼
改/etc/network/interfaces:
設定好所有LAN Interfaces
Ubuntu 11.04/11.10
  1. 1. sudo nano /etc/network/interfaces
複製代碼
Debian (要係root)
  1. nano /etc/network/interfaces
複製代碼
2.係nano度改
共通

  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).

  3. auto lo
  4. iface lo inet loopback

  5. auto eth0
  6. iface eth0 inet static
  7. address 192.168.0.1
  8. broadcast 192.168.0.255
  9. post-up iptables-restore < /etc/iptables.conf
  10. post-up ip route add 192.168.0.0/24 dev eth0

  11. auto eth1
  12. iface eth1 inet static
  13. address 192.168.1.1
  14. broadcast 192.168.1.255
  15. post-up ip route add 192.168.1.0/24 dev eth0

  16. auto eth2
  17. iface eth2 inet static
  18. address 192.168.2.1
  19. broadcast 192.168.2.255
  20. post-up ip route add 192.168.2.0/24 dev eth2
  21. post-down iptables-restore < /etc/iptablesdown.conf

複製代碼
Internet Connectivity (PPP):

點都要有Internet Connectivity
首先要Bridge左Modem先(因為要Router做PPP)
Ubuntu 11.04/11.10

  1. 1. sudo pppoeconf
複製代碼
Debian(要root)

  1. 2. pppoeconf
複製代碼
NAT:
Ubuntu 11.04/11.10 :

  1. 1.sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
  2. 2.sudo iptables-save > /etc/iptables.conf
複製代碼
Debian(要root) :

  1. 1.iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
  2. 2.iptables-save > /etc/iptables.conf
複製代碼
DHCP Server:
Ubuntu 11.04/11.10 :

  1. sudo apt-get install isc-dhcp-server
  2. Y
  3. nano /etc/dhcp/dhcpd.conf
複製代碼
Debian(要root) :

  1. apt-get install isc-dhcp-server
  2. Y
  3. nano /etc/dhcp/dhcpd.conf
複製代碼
共通

  1. [u]將 /etc/dhcp/dhcpd.conf變成:[/u]
  2. option domain-name-servers 192.231.203.3;
  3. option domain-name-servers 192.231.203.132;

  4. default-lease-time 600;
  5. max-lease-time 7200;

  6. subnet 192.168.0.0 netmask 255.255.255.0 {
  7.   range 192.168.0.2 192.168.0.254;
  8.   option broadcast-address 192.168.0.255;
  9.   option routers 192.168.0.1;
  10. }

  11. subnet 192.168.1.0 netmask 255.255.255.0 {
  12.   range 192.168.1.2 192.168.1.254;
  13.   option broadcast-address 192.168.1.255;
  14.   option routers 192.168.1.1;
  15. }
複製代碼
(唔使係eth2到行DHCP Server,因為要Set Modem IP: 192.168.2.2)
回復

使用道具 舉報

 樓主| 發表於 24-1-2012 10:34:37 | 顯示全部樓層
Setup SSH(Secure Shell) Server
如果你係一個sysadmin,你可以利用SSH進行Remote Management(係第二部電腦度打Command)

  1. (sudo) apt-get install openssh-server
複製代碼
再係第二部(Linux)電腦度打

  1. ssh user@(IP of ppp0)
複製代碼
跟住打USER 密碼就可以


不過,打USER 密碼個方法係好唔安全
因為可以俾HACKER Brute Force破門而入
所以可以用Public Key infrastructure

係第二部(Linux)電腦度打

  1. ssh-keygen -t rsa -b 4096
複製代碼
俾佢一個名
Passphrase可以唔打(直接ENTER)
再打
  1. ssh-copy-id -i name.pub user@(ip of router)
複製代碼
再改/etc/ssh/sshd_config
而uncomment "Password Auth no"個行
再打 (sudo) /etc/init.d/ssh restart就可以
回復 支持 反對

使用道具 舉報

發表於 24-1-2012 13:00:52 | 顯示全部樓層
只用windows
回復 支持 反對

使用道具 舉報

 樓主| 發表於 24-1-2012 14:04:14 | 顯示全部樓層
只用windows
9298 發表於 24-1-2012 15:00

TP-Link/Dlink嘅Router Firmware係Linux-based
回復 支持 反對

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

小黑屋|Archiver|手機版|Nakuz.com |網站地圖

GMT+8, 6-5-2025 08:54 , Processed in 0.052714 second(s), 11 queries , MemCache On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回復 返回頂部 返回列表