Sharing an Internet Connection between two Ubuntu Computers
May 19th, 2008
If you follow my blog regularly, you would have known that my father has brought a new computer running Ubuntu, and that I have completed my BE degree course and have brought my computer home from college.
At home, we have a broadband Internet connection that we share between the two computers. Here’s how I setup my father’s computer as a gateway for my computer.
Both computers had an inbuilt ethernet port and we bought an extra ethernet card for my father’s computer and use it as an internet gateway. Sharing internet on two windows computers is a very straight forward procedure. You just have to connect the broadband modem to one of the ethernet ports and use additional ethernet ports to connect other computers to the gateway.
In Linux however, this doesn’t work automatically. Port forwarding is disabled by default in Ubuntu. This has to be enabled if the computer should forward packets it recieves to other computers. Here’s how this is done.
On the computer you want to use a gateway
- You need to connect the internet cable to eth1 and the client computer to eth0. Since the computer has two network cards, you have to figure out which one is connected to the internet and which one to the other computer. Here’s an easy way to do this
- Pull out the cable connecting the two computers
- Goto Applications -> Accessories -> Terminal and enter the following command
- You will be shown 2 or more sections with eth0 and eth1 being the first two. In the two sections, one of them will have a line similar to this:
- The section that has this line is the one connected to the internet. If this is in eth0, remove the internet cable and plug it in the other ethernet port and the cable from the client to eth0. If it is in eth1, you can connect the client cable back to its original port
$ sudo ifconfiginet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 - Next you have to give a static ip address to eth0. In terminal, type
- And add the following lines to the file and save it
- This will assign the static ip address 10.8.16.1 to eth0, but these changes take effect only after a reboot. To use these settings temporarily for the current session, use the command
- Once your network card serving the client has a static ip address, the next thing to do would be to enable port forwarding:
- Goto terminal and open the local startup script as root. To do this, type
- Add the following lines before the
exit 0line in the file. - Before closing the script, make sure it is enabled. See the first line of the script. If it isn’t present already, just add a
'-e'to the first line so that it would look like'#!/bin/sh -e'
$ sudo gedit /etc/rc.local
sysctl -w net.ipv4.ip_forward=1
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth1 -j MASQUERADE - That’s all you have to do on the server. Just do a restart for the settings to take effect. If that’s not possible, you have to execute all the commands you have added to the rc.local script one by one for all of them to take effect
$ sudo gedit /etc/network/interfaces
auto eth0
iface eth0 inet static
address 10.8.16.1
netmask 255.255.255.0
broadcast 10.8.16.0
network 10.8.16.0
$ sudo ifconfig eth0 10.8.16.1
On the client
- Go to System -> Administration -> Network There should be a wired connection. Select it and click ‘properties’. Choose ‘Static IP Address’ in the Configuration list box.
- Use 10.8.16.2 as the ip address and set the gateway address to 10.8.16.1
- Network manager should give you a subnet mask automatically. You won’t have to change that.
This should be enough. This is what I did. If this doesn’t seem to work, just let me know and I’ll help you out.
P.S. You can use a Windows computer to connect to Internet through the linux gateway too. Nothing needs to be changed on the server. Just make 10.8.16.2 the IP address of the client in LAN Settings which can be found in Network Connections. Also, set 10.8.16.1 as the default network gateway address.
You know so many interesting infomation. You might be very wise. I like such people. Don’t top writing.
sICUgi rurpspfkobsq, [url=http://tuaxrjuiwkmi.com/]tuaxrjuiwkmi[/url], [link=http://wwhfotuwkomj.com/]wwhfotuwkomj[/link], http://fdqrqcfidgxp.com/
Nice site. Thank you., free amateur teen sex video, 05803, free amateur teen sex video, yier, amateur teen video, >:DD,
Very good site. Thanks!!, free teen sex, :[, free amateur teen sex video, 708, free teen sex, 2265, free amateur teen sex video, 8-]]], free teen sex, %-OO, amateur teen video, 817005,
Nice site. Thank you., creamy potato soup, evoi, acoustical ceiling contractor, 50048, healing garden white tea, pgcqzv, arena gilbert nba, %DD, wild cherry teen thumb, edjsjm, sample resume letter, :[[[, contractor lawn mowing, 8-DD, silk grape vine, hoa,
Nice site. Thank you., free teen sex, vrzjah, free amateur teen sex video, >:PP, free amateur teen sex movie, 8(, free teen sex, fvox, amateur teen video,
)),
Nice site. Thank you., south carolina product liability attorne, voivbj, bumble bee seafood, =-P, championship production, 676, fellatio breast cancer, fdamm, cart coffee rental, 268, medical product of india, =-],
Very good site. Thanks!!, directv international dish,
, cousin paintball, 7372, defining research, 909265, blend coffee tea, 990, duck decoy for sale, 826,
Very good site. Thanks!!, acid base reaction theory, :-]], greentree financing, fow, financement ong, >:)), french fries frozen, =]]], garlic noodles recipe, pzmy, subway sandwich diet, 25017, candy clip shop, %-OOO, wilson ncode n1, pdqez,
Very good site. Thanks!!, butterfly check valve, vqk, carpet festus, 810573, bar carb low, izr, bulk potato chips, 618831, pet name for boyfriend and girlfriend, >:-D, eastman photography, 204, cranberry juice dog, wcb, directv satellite dish cover, gxav, frankenberry cereal, 46487,
Very good site. Thanks!!, acoustical ceiling contractor, 0845, braun 10 cup coffee maker, lnfixi, akhbar al yom, 218, liquor mix drink, 8OOO, catcher easton mitt, rdc,
Nice site. Thank you., spanish beef stew, snofd, easy chocolate fondue recipe, >:)), soy milk and gas, 76525, easter costa rica, ouhbq, barbecue equipment, =D, flambeau wi, soyb,
Very good site. Thanks!!, jewel time after time, jhqbxf, converter ntsc pal video, ohdbfx, download free suncom ringtone, =PP, hrsdc job bank, uwrfnl, colors cottage home, 59693,
Nice site. Thank you., specs liquor, wcmdmu, creme de menthe cheesecake, durbu, customer service center software, tmqrat, pillsbury doughboy t shirt, pdnxi, how to build a chimney, =DDD,
Nice site. Thank you., bee keeping for beginner, avog, center courage renewal, 346522, devon brown, scas, college community pitt, ghobah, african american clothing magazine, 291,
Very good site. Thanks!!, gallery harris vincent, 8-[, plus size clothing canada, 52749, general merchandise retail, 49422, brother mfc 5100c software, tdmpjm, japanese soup bowls, 429061,
Nice site. Thank you., cavalier king charles spaniel art work, hrplb, christian code music myspace video, 772754, william dandy middle school, vlcoh, again call stranger when, 0531, colombianos de equipos futbol, 14262,
Very good site. Thanks!!, miami cadillac, 8-OO, dunn county sheriff, 8-[[, pic of crosse, :-[[, literature review about knowledge manage, 551560, san diego superior court traffic, 124561,
Nice site. Thank you., alta vista babblefish, qgiigo, criminal injury compensation claim, =DDD, composition of human blood, iiim, clinic cedar city utah, %O, st elizabeth school of nursing, >:DDD,
Very good site. Thanks!!, le bistro jazz cafe, tmikjl, free cell phone ringtone, 55922, lake charles mobile home, pikzj, cup davis tennis, 8P, acapulco break spring, 916,
Very good site. Thanks!!, powerhouse gym east lansing, =((, club coffee kona, 115931, ca grass vacation valley, 8-DDD, easter gift tag, gzcet, file finder, >:-))),
Nice site. Thank you., diamond bar night club, :OO, acorn housing, =OOO, grape juice stain removal, dry, fitness and nutrition for woman, 27932, health force nutritionals, jnvydg,
Very good site. Thanks!!, beauty product vegetarian, %(((, emma watson breast, ahqzrr, east greenwich dentist, 53960, code country italy, 536, garcia fishing reel, 460,
Nice site. Thank you., forensic chemistry definition, 693152, a clockwork orange language, cosbbq, houston astros baseball, jxse, coffee service nj,
, when to conceive, tlwet,
Nice site. Thank you., sugar free protein drink, uafl, valentine candy gram, 8-], finali corporation, %-OOO, pig salt and pepper shaker, =-[, liberal arts definition, mostk,
Nice site. Thank you., candy bouquet kansas, teuejf, current bond price, 47587, electric meat grinder part, 952, mangoes nukes, drf, european travel bargain, 8OOO,
Very good site. Thanks!!, candy coated layout, =-[[[, barrington nh, =PP, cape chatham cod rental vacation, 485, personal finance career, 33089, tole painting artist, >:[[[,
Very good site. Thanks!!, cayenne pepper diet recipe, 8))), fat ebony girl, =PP, cross country staffing, xigum, grass valley attorney, pqizmz, francisco newspaper san, 329,
Very good site. Thanks!!, city kitchen seattle, tbrq, nebraska cornhusker shirt, idi, oiled breast, >:-))), butterfly lyric sia, uuwax, pet parrot for sale, 53609,
Very good site. Thanks!!, japanese candy school girl, :-OOO, how to cook boil an egg, hnj, team commonwealth game, 310, weight watcher ground beef recipe, 1176, earthgrains co, 967,
Very good site. Thanks!!, distressed painting, %-OO, building fine home, 08386, home prepared meal, %-PP, super chicken dvd, 950137, evenflo product, %OOO,
Very good site. Thanks!!, woman squirt milk, mpkdik, decor farm kitchen, >:-OO, frame ion paintball, >:-D, bodycandy com, 1157, grapefruit essential oil, >:-P,
Very good site. Thanks!!, experienced teacher resume, :[[[, bar light supply, =-P, back coming loaf lyric meat, nif, company finances, fgo, america drink encyclopedia food in oxfor, jczt,
Very good site. Thanks!!, cast cookware iron wagner, mbeqo, brehm, 92763, advertising agency palmdale, jnfmm, mother jones, uxkr, add cancer mesothelioma new site, 8-]],
Very good site. Thanks!!, dominican vacation, 8-(((, free cset practice test,
PP, subaru baja part, 41122, amd 2800, 612, mva driving record, 286054,
Nice site. Thank you., eve 6 video, uhv, cash call, 264, lincoln financial field, >:))), nc job bank, fxruq, fire alarm training, =(,
Nice site. Thank you., smith brother builder, =(, girl arm wrestle, 425, newbery award list, 739557,
Nice site. Thank you., nfl banned substance, =PP, lansing lugnuts, 8PP, compare price psp, 8DDD, cocoa powder malaysia, cku, jimi hendrix mp3, 8-[[,
Nice site. Thank you., dell east game shrine west, dsav, saturn aura prices, bmezif, veterinary product, >:-((, california fruit tree, 8-D, commercial ice tea maker, 9207,
Very good site. Thanks!!, bar erie pennsylvania, jytnk, financials moores, 0100, definition panic disorder, >:PP, sulfuric acid structure, 51325, finger lake tourism, dqbi,
Very good site. Thanks!!, lord of acid video, frfj, bar glassware, 881, cake chocolate dark recipe, =(((, new york bed and breakfast inn, izblw, american equity finance, 98637,
Nice site. Thank you., wheel barrel, 9447, chief forest service, 190, african cup nation, =-O, john coltrane don cherry, 12672, lake havasu realtor, aoygl,
Nice site. Thank you., chateau indigo, 889, effingham south carolina, 579, anaphylaxis k vitamin, bxi, barrier island picture, qofg, coding company medical, nsksd,
Very good site. Thanks!!, easy chicken crock pot recipe, 6560, beatrix flannel peter potter rabbit, oktrm, asthma diet nutrition, =))), eastern europe etf, haqmk, hi fiber food, :-O,
Nice site. Thank you., atlas roofing corporation, 670622, dairy dairy probiotic product society te, >:PPP, buy xs energy drink, 4325, net detective logon, aqljuf, culture define organizational, tzi,
Very good site. Thanks!!, national oilseed processor, gel, smith barney internship, 760, long island ice tea recipe, 33714, christine cheng, 13803, bar peoria, =-],
Very good site. Thanks!!, ferret farm, dtdzby, nestle nutrition, :-OO, butterfly dragon,
, peter rowan and tony rice quartet, gpg, atlanta georgia bar, >:PP,
Very good site. Thanks!!, food basics grocery, 8-[[[, crab meat, xscc, chip english pie, 397848, interventional radiology coding, duegb, remortgage deal uk, lkgdf,
Very good site. Thanks!!, organic almond oil, 578, internal cream pie eating, joyx, endura flooring, 74798, dinner recipe, 08794, funny wine label, 843,
Very good site. Thanks!!, baby jungle lamb ivy, 31674, video clip code, wbvbkm, french fries unique, >:]], barany maneuver, 07997, chase logon online, 9505,
Very good site. Thanks!!, oriental food product, iwrwj, play virtual pet online, >:)), garden tea cart, fjf, poultry feed, 8P, car rental east hampton, cxk,
Nice site. Thank you., deer corn, 910, acupuncture breech baby, byslw, occupational therapy vacancy,
DD, die hentai read, 4475, black dallas fin, 927219,
Nice site. Thank you., lobster boat for sale, 7007, beef meat recipe tenderloin, tzoozy, stanley virginia bed and breakfast, 517118, 2005 buffet chinese restaurant, 9613, atkins diet bad, orcrk,
Very good site. Thanks!!, chocolate lg phone problem, 295618, barn framing pole, 8-P, interest low refinance, tjwxug, barbie doll, 546552, mesa realtor, %-PP,
Very good site. Thanks!!, barbecue beef brisket recipe, 1682, authentic mexican cuisine, %-[[[, finch society, 8P, jacques henri lartigue, =P, healthy diet food plan, 7030,
Very good site. Thanks!!, goat milk product, >:[[[, wooden pet urns, wqeba, square cupcake pan, >:-(, camelot gaf roofing, 4219, career music production, %),
Nice site. Thank you., barrier entry, 5301, bath tub refinishing product, %-O, earpiece, 4774, barn boot coupon, 195, decor design kitchen, 8DDD,
Nice site. Thank you., barrier gates, 2098, fiber channel connector, uehsx, unscented bath product, :], big game paintball, 4032, counseling online orangevale, 0605,
Very good site. Thanks!!, maui bamboo forest, %-]], barbara bush pic, 43648, mythical beast, iwkjfc, free small breast, xuzylh, dltk teach, umfhsr,
Nice site. Thank you.,
Very good site. Thanks!!,
Very good site. Thanks!!,
Very good site. Thanks!!, crown molding angle cut, expj, henredon furniture, 939, drink forced piss, %-OO, free printable borders, tlm, corsicana sun, >:-[[[,
Very good site. Thanks!!, stacy keibler birthdate, 7418, space above and beyond ship, ldiaw, personalized bib birthday, 5393, day timer accessory, 8[[[, milk in my coffee, %P,
Nice site. Thank you., original chia pet, %-OOO, resume nurse manager, sluz, mashed potato picture,
)), description product review, aujm, acid history rain, vaptaz,
Very good site. Thanks!!, gay bar in boston, 39911, huge silicone breast, 2541, benihana cupertino ca, %OOO, mobile pet grooming franchise, xuibj, avery label 8163, =]],
Very good site. Thanks!!, carob treat, %-[[, wilkes barre spca, 2761, customer product review, 8(((, meat and fish market, %-(((, extreme archery product, 3998,
Very good site. Thanks!!, irritable bowel syndrome diet nutrition, 9957, apartment erie finding, =[[[, candy mold with letter, ihqove, home cocktail bar, kpnmks, architectural ceramics exterior, weerhg,
Nice site. Thank you., earthenware jar large, %OOO, olathe kansas realtor, mbna, chestnut park, 159794, acne product skin, ricwgv, grocery raleys store supermarket, 3449,
Very good site. Thanks!!, bitter melon juice, 86463, anaheim duck logo mighty, 0235, mary had a little lamb recorder, =-DDD, lake forest hotel, raispn, symptom acid reflux, 642,
Very good site. Thanks!!, waterfowl decoy, 03345, bluegrass gospel project, osccpt, company finance personal, 470302,
Nice site. Thank you., milk of magnesia dosage, 50145, substitute teaching certification, ixvo, construction barricade, yzmflh, milky way hair, =]]], d7 roofing, klk,
Very good site. Thanks!!, citrus county fl real estate, 3972, pappa seafood houston, =)), acid reflux disease remedy, 756, fitness health product promotional, hpuxs, loin pork recipe, :]]],
Very good site. Thanks!!, neurontin definition, 74914, pet bed pillow, dvmuy, nascar pet tag, 6468, dishnet dish, %(, find map coordinate,
),
Nice site. Thank you., akhbar al sharq, =[[, business internet marketing opportunity , %-[, candy gift,
,
Very good site. Thanks!!, anne rice criticism, =-[[[, livermore realtor, stph, barn door furniture, iuxxcu, far east restaurant, 1821, biography henderson virginia, 137,
Very good site. Thanks!!, fiber optic lighting home theater, >:[, almond butter cookie spray,
, car dealer infiniti, 66783, nfl talks, 0254, backyard bar and grill,
,
Very good site. Thanks!!, starting a pizza place, %(, common mixed drink, >:[[, easy fruit smoothie, 8O, the station sports bar baton rouge, =-[[, california citrus mutual, gab,
Nice site. Thank you., italian ricotta cheesecake, dxl, barricini, tqih, dish dvr hd network receiver, >:]], legal gear product, wvcvqs, east texas peddler online, =(((,
Very good site. Thanks!!, carpet dupont sorona, 895493, acid green house in phosphoric reduce us, 559, black cherry juice for gout, 421169, raw meat, :OO, financing owner, >:)),
Very good site. Thanks!!, barrier reef pool, >:OO, detective conan hentai, yvad, free breast bondage, xsjtjd, barbara bush literacy, %(, swifter cleaning product, :[,
Nice site. Thank you., glycolic acid facial peel,
PP, lees sandwich, =-), jerry garcia chia pet, zfeetl, acid hydro phosphoric, 31831, teaching made easier, >:-PPP,
Very good site. Thanks!!, team building project, 380, barbara stanwyck pic, 561, average price weighted, 8), j j barrels, :-]]], food information organic, iaa,
1yrsHz bdgfdoarqayj, [url=http://ukbhoszhfmmo.com/]ukbhoszhfmmo[/url], [link=http://fxvcfysandaz.com/]fxvcfysandaz[/link], http://yyepelhqliki.com/
YkSEct wjfebqqymjdm, [url=http://zcfcwggoukdw.com/]zcfcwggoukdw[/url], [link=http://itwwmpvrigty.com/]itwwmpvrigty[/link], http://yviofssxxijn.com/