Configure your computer as a router (wired) under 1.ubantu
Prepare two computers PCA:PCA configured as routers, Ubantu system
PCB:PCB as a terminal, Win7 system
(1). Configure two net card information: eth0 (wired Ethernet card) and Wlan0 (wireless card): $/etc/network/interface Edit the following information
Auto Lo
Iface Lo inet Loopback
Auto Wlan0
Iface wlan0 inet Static
Address 192.168.1.102
Gateway 192.168.1.1
Netmask 255.255.0.0
Auto Eth0
Iface eth0 inet Static
Address 192.168.6.1
Netmask 255.255.255.0
Network 192.168.6.0
Broadcast 192.168.6.255
(2). Execute IPv4 forward script router.sh
#!/bin/sh
Echo 1 >/proc/sys/net/ipv4/ip_forward
Cat/proc/sys/net/ipv4/ip_forward
Ifconfig eth0 192.168.6.1 up
Iptables-t nat-f
iptables-t nat-a postrouting-s 192.168.6.0/24-o wlan0-j Masquerade
(3). If PCA is unable to surf the internet at this time, see if you are configuring a default gateway: $ route-n
If you do not have a default gateway, add a default gateway: Route Add-default GW 192.168.1.1
(4). Use a network cable to connect the PCA and PCB, disable the wireless PCB, ready to test whether the PCB through the PCA Internet
Manually modify the IP address of the PCB: 192.168.6.10
Gateway: 192.168.6.1
Subnet Mask: 255.255.255.0
dns:8.8.8.8 (if the above configured PCB still can not surf the internet, may be a DNS resolution problem )
(5). Building a DHCP server on PCA
In step (4), we always need to manually configure the IP for the PCB, it is more troublesome, we can get it automatically by DHCP to obtain the IP, the method is as follows:
Install DHCP server: $sudo apt-get install Isc-dhcp-common isc-dhcp-server
(i) Modify/etc/default/isc-dhcp-Server
interfaces= "eth0"
(ii) Modification of/etc/dhcp/dhcpd.conf
Subnet 192.168.6.0 netmask 255.255.255.0 {
Range 192.168.6.100 192.168.6.200;
option routers 192.168.6.1;
option broadcast-address 192.168.6.255;
Default-lease-time 600;
max-lease-time 7200;
}
Reference Blog: http://www.blogjava.net/canvas/articles/router-dhcp.html
2.ubantu Configure the computer as a router (wireless hotspot mode) to be updated ...
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Configure your computer as a router under the Linux system