8,367
edits
Changes
→Orange Pi R1 Routing System Adaptation
<div>[[文件:Orange-pi-r1-img-25.png|600px|]]</div>
<br>
=== '''Configure NAT''' ===
<br>
<div>[[文件:Orange-pi-r1-img-27.png|800px|]]</div>
<br>
1)On the above picture,Gateway is OrangePiR1, one of the network card (eth1) connect with Internet, the other network card (eth0) connect with Intranet.<br>
2)Configure process of Gateway: <br>
i Install iptables<br>
$ sudo apt-get install -y iptables<br>
ii Configure /etc/network/interfaces as following, one of eth1 use IP address assigned by system automatically:
<div style="padding-left:200px;">[[文件:Orange-pi-r1-img-28.png|400px|]]</div>
<br>
iii Configure of iptables:<br>
iptables -F<br>
iptables -P INPUT ACCEPT <br>
iptables -P FORWARD ACCEPT<br>
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE<br>
3)Configure of OrangePiPc:<br>
Configure of /etc/network/interfaces:
<div style="padding-left:200px;">[[文件:Orange-pi-r1-img-29.png|400px|]]</div>
<br>
Configure of DNS server address on /etc/resolv.conf
<div style="padding-left:200px;">[[文件:Orange-pi-r1-img-30.png|400px|]]</div>
<br>
4)Test<br>
If ping could connect to <span style="color:#428ac9;">www.baidu.com</span> on OrangePiPc, then the NAT configure successful.<br>
<br>
=== '''Configure DHCP''' ===
<br>
1)DHCP Server configuration process(OrangePiR1)<br>
a.Install dhcp server command on Ubuntu15.04 of OrangePiR1:<br>
$ sudo apt-get install -y isc-dhcp-server (note the name of package)<br>
b.Modify network file on /etc/default/isc-dhcp-server as following:<br>
<nowiki># On what interfaces should the DHCP server (dhcpd) serve DHCP requests?</nowiki><br>
<nowiki># Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="eth0"</nowiki><br>
c.Modify file of /etc/dhcp/dhcpd.conf, which is for configuring the IP range allocated by DHCP, example for configuring 192.168.3.0:<br>
subnet 192.168.3.0 netmask 255.255.255.0 {<br>
range 192.168.3.100 192.168.3.105;<br>
<nowiki>option routers 192.168.3.; #Configuring the client default gateway must be added</nowiki><br>
option broadcast-address 192.168.3.255;<br>
default-lease-time 600;<br>
max-lease-time 7200;<br>
}<br>
d.Start the DHCP service on OrangePiR1<br>
$ service isc-dhcp-server start<br>
<br>
2)Configure process of DHCP(OrangePiPc)<br>
a.Configure of /etc/network/interface
<div style="padding-left:200px;">[[文件:Orange-pi-r1-img-31.png|400px|]]</div>
<br>
b.OrangePiPc client uses the following command to automatically obtain IP<br>
$ dhclient eth0<br>
<br>
For more information on using the Orange Pi R1, please see the <span style="color:red;">Orange Pi R1 User Manual</span>. (Click to download)