/
NatGateway.html
192 lines (170 loc) · 8.16 KB
/
NatGateway.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!doctype html>
<html>
<head>
<title>Quick Internet Sharing With a Laptop NAT Gateway - CSCLUG.org</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body class="tutorials" data-spy="scroll" data-target=".subnav" data-offset="50">
<!-- Navbar
====================================================== -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="./index.html">CSCLUG</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="">
<a href="./index.html">Welcome</a>
</li>
<li class="">
<a href="bookReviews.html">Book Reviews</a>
</li>
<li class="">
<a href="calendar.html">Calendar</a>
</li>
<li class="">
<a href="jobs.html">Job Postings</a>
</li>
<li class="">
<a href="localGroups.html">Local Groups</a>
</li>
<li class="">
<a href="presentations.html">Presentations</a>
</li>
<li class="">
<a href="projects.html">Projects</a>
</li>
<li class="active">
<a href="tutorials.html">Tutorials</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--Content
====================================================== -->
<div class="container">
<header class="jumbotron subhead" id="overview">
<h1>Quick Internet Sharing With a Laptop NAT Gateway</h1>
<p class="lead">From Hacking to Tunneling to Clouds and Green Pastures, learn from our fun group.</p>
</header>
<hr class="soften">
<section id="welcome">
<div class="row">
<div class="span8">
<h1>Quick Internet Sharing With a Laptop NAT Gateway</h1>
<p>This text assumes that you know the basic structure of your particular distribution including configuration file locations, network configuration, and root access.<br><br/>
<h2>Assumptions:</h2><br><br/>
1. Two network interfaces exist on your server machine: <br/>
a. A wired interface (eth0) which will interface the local network<br/>
b. A wireless interface (wlan0) which will interface the internet <br/>
2. All required software packages (NAT, iptables, etc) are installed on the
server machine <br/>
3. A wired interface exists on the client machine (eth0)<br/>
4. All commands should be issued as a super user who has /sbin in their
path<br/>
5. Client is connected to the server via ethernet cables and a switch or
directly via a patch cable<br><br/>
<h2>Server Procedure:</h2><br><br/>
1. Configure eth0 with a static IP:<br/>
a. IP Address: 192.168.0.1<br/>
b. Netmask: 255.255.255.0<br/>
c. Broadcast: 192.168.0.255<br/>
NOTE: Network managers will override these settings when an active link is
detected. For best results, disable the management of this device by a
network manager and configure the device manually using 'ifconfig'.<br/>
NOTE 2: You should only have to set the IP address. All other settings will
default based on the assigned IP address.<br/>
Example:
ifconfig eth0 192.168.0.1
2. Configure IP forwarding.<br/>
a. IP forwarding is VERY distribution specific. For most distributions a flag
can be manually set in /proc/sys/net/ipv4/ip_forward with a command:
echo 1 > /proc/sys/net/ipv4/ip_forward<br/>
b. Most distributions also have the ability to edit a script in the /etc/init.d
or /etc/rc.d directory to allow IP forwarding at startup. Most times all you
have to do is set the script's file permission to executable.<br/>
c. For Ubuntu users, this setting is found in /etc/sysctl. The parameter is
#net.ipv4.conf.default.forwarding=1<br/>
To enable this at startup, remove the comment(#) from this line. See
man sysctl for other options.<br/>
3. Configure iptables<br/>
a. Allow packet forwarding with:
iptables -P FORWARD ACCEPT<br/>
b. Configure Network Address Translation (NAT) with:
iptables --table nat -A POSTROUTING -o wlan0 -j MASQUERADE
NOTE: This has absolutely no security. All packets received will be
forwarded to every machine on the network attached to the eth0
device. See man iptables for more options to increase security.<br><br/>
<h2>Client Procedure:</h2><br><br/>
1. Configure eth0 with a static IP:<br/>
a. IP Address: 192.168.0.100 (any IP in the range 192.168.0.2 - 192.168.0.254
will be fine as long as it is unique on the network)<br/>
b. Netmask: 255.255.255.0<br/>
c. Broadcast: 192.168.0.255<br/>
d. Gateway: 192.168.0.1<br/>
NOTE: Network managers will override these settings when an active link is
detected. For best results, disable the management of this device by a
network manager and configure the device manually using 'ifconfig'.<br/>
NOTE 2: You should only have to set the IP address. All other settings will
default based on the assigned IP address.<br/>
Example:
ifconfig eth0 192.168.0.100
2. Configure DNS:<br/>
a. On the server machine, view the file /etc/resolv.conf<br/>
b. Copy the nameserver lines to /etc/resolv.conf on the client machine<br/>
c. Example nameserver line:<br/>
nameserver 192.168.1.1<br/>
This material has been digested from various tutorials across the internet. The goal behind this tutorial is to rapidly establish an internet connection for a local wired network through a laptop's wireless internet connection.<p></p>
</div>
<div class="span4">
<h3>Upcoming Events</h3>
<div id="calendar"></div>
</div>
</div>
</section>
<!--Footer
====================================================== -->
<footer class="footer">
<div class="row">
<div class="span7">
<p>Built from <a href="http://twitter.com/twitter" target="_blank">@twitter</a>'s Bootstrap and modified by the Charleston Linux Users Group -
<a href="https://twitter.com/imabug">@imabug</a>, <a href="https://github.com/covertcodeop">@covertcodeop</a>, <a href="https://github.com/tedb">@tedb</a>, and <a href="https://github.com/caboose885">@caboose885</a>.</p>
<p>This site is licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
<p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
</div>
<div class="span4 offset1">
<div class="well">
<ul class="unstyled sponsors">
<li class="nav-header">
Our Longtime Supporters
</li>
<li class="">
<a href="http://oreilly.com/"><img src="http://ug.oreilly.com/promote/ug_ad_250_viguy.gif" alt="Oreilly User Group Program"></a>
</li>
<li>
<h2> <a href="http://www.butterfat.net/"><span class="label butterfat">Butterfat, LLC.</span></a></h2>
</li>
<li>
<a href="http://makelabcharleston.org/"><img src="http://makelabcharleston.org/sites/default/files/logo-400.png" alt=">MakeLab, Charleston" height="52.29" width="252" </a>
</li>
</ul>
</div>
<p class="pull-right"><a href="#">Back to top</a></p>
</div>
</div>
</footer>
</div>
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.7.1.min.js"><\/script>')</script>
<script type="text/javascript" src="js/jquery.dateFormat-1.0.js"></script>
<script type="text/javascript" src="js/site.js"></script>
</body>
</html>