LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-07-2007, 11:40 PM   #1
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Rep: Reputation: 15
Question How to configure network connection??


what command should i run to config the network?
i have to LAN currently,
LAN#1 to cable modem (dhcp/auto) (shared under windows)
LAN#2 to 2nd computer

when i go to control center > internet > setting
i was ask to choose distribution? no slackware v11 on the list, so i choose slackware 10.2
both eth0 and eth1 is disable, so i tried to set eth0 to use dhcp, auto, and then enable it...
but still, no internet connection..

help please..
 
Old 06-08-2007, 02:03 AM   #2
mimithebrain
Member
 
Registered: Nov 2003
Location: ~
Distribution: Ubuntu 10.04
Posts: 843
Blog Entries: 1

Rep: Reputation: 30
You can set the internet connection manually, it's very simple.

Load a konsole, and become root.

ifconfig <interface> [ip address] [state]

That is, you can do "ifconfig eth0 up", then dhclient (or dhcpcd, or even pump -i eth0) to bring up your internet interface...

Then you can do "ifconfig eth1 192.168.1.200 up" to enable your interface going to the other computer with the private ip address specified.

ifconfig can take down as a state to disable to interface.
ifconfig <interface> will simply display the current status of that interface.
ifconfig by itself will show the status of all enabled interfaces.
ifconfig -a to show all interfaces

In the statup scripts, you can set eth0 to load automatically. (hint: /etc/rc*)
 
Old 06-08-2007, 02:04 AM   #3
sparc86
Member
 
Registered: Jul 2006
Location: Joinville, Southern Brazil
Distribution: Debian, CentOS
Posts: 296

Rep: Reputation: 31
I suppose you have a router/modem.

Use the commands:

ifconfig #this will show your ethernet interfaces, if there was nothing, then try the next command.

ifconfig eth0 192.168.0.5 netmask 255.255.255.0 #This will set the IP 192.168.0.5, you can use whether IP you prefer.

route add default gw 192.168.0.1 #this will set 192.168.0.1 as your default gateway, which is your router address. The routers IP may differ.

route #Check if it is right.


ping www.somehost.com #if you're receiving the packets, it's working. :-)

Last edited by sparc86; 06-11-2007 at 05:13 PM.
 
Old 06-08-2007, 02:37 AM   #4
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Original Poster
Rep: Reputation: 15
i use modem, i dont have router
here's the scheme :
modem -> PC1 -> PC2
i use eth0 to connect to internet
i use eth1 as gateway for PC2 to connect to internet...
so i suppose i ll use:
Code:
ifconfig eth0 up
dhcpcd
ifconfig eth1 192.168.0.1 netmask 255.255.255.0
rite?

btw, whats "ifconfig" stands for? interface config? just curious..

Last edited by cuek80; 06-08-2007 at 02:46 AM.
 
Old 06-08-2007, 03:22 AM   #5
bzyk
Member
 
Registered: Jun 2007
Location: Poland
Distribution: Debian, Slackware
Posts: 42

Rep: Reputation: 15
BTW, you can use netconfig script (in console as root, type; netconfig)
Yes; ifconfig is a tool for config interface, but IMHO better tool is iproute2.
 
Old 06-08-2007, 10:33 AM   #6
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Original Poster
Rep: Reputation: 15
Code:
root@xxx:~# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
root@xxx:~# ifconfig eth0 up
root@xxx:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:FC:CB:5D:09
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:2360 (2.3 KiB)
          Interrupt:11 Base address:0xf800
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
root@xxx:~# dhclient
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
No broadcast interfaces found - exiting.

why is that?
 
Old 06-08-2007, 10:56 AM   #7
Fosforo
LQ Newbie
 
Registered: Jan 2007
Distribution: Slackware 11.0
Posts: 22

Rep: Reputation: 16
I don't know if it happens to anyone else, but dhclient acts funny in Slackware for me. Try using:
Code:
dhcpcd eth0
or replace eth0 with the interface you are trying to get an ip address for. That worked for me.
 
Old 06-08-2007, 11:23 AM   #8
mimithebrain
Member
 
Registered: Nov 2003
Location: ~
Distribution: Ubuntu 10.04
Posts: 843
Blog Entries: 1

Rep: Reputation: 30
Cool

you are on the right track cuek80.

If you want to do IP forwarding, use this script as a reference, enter this in your first PC (modified from http://www.yolinux.com/TUTORIALS/Lin...rkGateway.html)
Code:
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

iptables --table nat --append POSTROUTING --out-interface ath0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward
where ath0 is my internet interface, and eth0 is my local interface.
This clears your firewall rules... careful... use firestarter for better results.

Don't forget to enter the IP address and route information in the second computer (hint: route add default gw [ip])
 
Old 06-08-2007, 12:56 PM   #9
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Original Poster
Rep: Reputation: 15
mimithebrain: u confuse me..
but i'll try it anyway after my internet LAN works.. or it doesnt matter??

anyway... i tried dhcpcd eth0, even b4 i start this thread.. nothing happen, though i didnt use ifconfig et0 up back then.. so i'll try that again later.
but let's make thing clear out.. i have 2 LAN, 1 is onboard, 1 using pci..
when i use SLAX on usb, i automatically get internet connection via eth0, so i just assume that'll be my onboard LAN, am i right? or it's diff for SLACK?
 
Old 06-08-2007, 01:25 PM   #10
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Original Poster
Rep: Reputation: 15
o my.. really sorry.. feel so stupid..
i just tried "ifconfig eth1 up" and "dhcpcd eth1" and it works..
thanks u guys..
now... about /etc/rc.d..
which file should i edit?

anyway, mimithebrain:
Code:
root@SUNTER:~# iptables --table nat --append postrouting --out-interface ath0 -j masquerade
iptables v1.3.5: Couldn't load target `masquerade':/usr/lib/iptables/libipt_masquerade.so: cannot open shared object file: No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
root@SUNTER:~# iptables --help
iptables v1.3.5
 
Old 06-08-2007, 01:51 PM   #11
mimithebrain
Member
 
Registered: Nov 2003
Location: ~
Distribution: Ubuntu 10.04
Posts: 843
Blog Entries: 1

Rep: Reputation: 30
"MASQUERADE", it's case sensitive.

Replace ath0 with the interface with the internet connection and eth0 with the interface with the local connection.

This will permit the second computer to connect to the internet.

If you don't want to do that, don't enter those commands. They are there just for your reference.
 
Old 06-08-2007, 02:15 PM   #12
cuek80
LQ Newbie
 
Registered: Apr 2007
Distribution: Slackware, Slax
Posts: 26

Original Poster
Rep: Reputation: 15
ow.. rite.. sorry
done!!
i haven't try the ip forward.. i ll try tomorrow...
thaaaaaaaaaaaaaaaaaaaanksssssssssssssssss
u guys r great!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network driver not avaiable anywhere to configure network on hp pavilion dv6000 Nitin Bhumkar Linux - Laptop and Netbook 1 01-18-2007 09:50 PM
PF - design/configure firewall for network using ADSL connection -- please help me b:z *BSD 3 06-22-2005 01:27 AM
how to configure my network on slackware 10.0 so i can access a windows network salviadud Linux - Newbie 2 02-11-2005 02:19 PM
How do I configure my adsl connection for network install? subaruwrx Debian 2 11-20-2004 08:09 AM
How to configure a Network everywhere fast network card under Linux Mandrake 7.2 margo256 Linux - Newbie 1 03-12-2001 11:45 AM


All times are GMT -5. The time now is 10:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration