LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 05-11-2008, 03:33 PM   #1
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Rep: Reputation: 15
wirelles network setup "script"


well, i have a lot of linux distributions on my system, and i want to write a script which will setup my internet connection over wirelles.. here is the script:

Code:
iwconfig wlan0 essid MICRO-PROCESS.BRIBIR;
iwconfig wlan0 channel 11;
iwconfig wlan0 key s:[my key];
ifconfig wlan0 netmask 255.255.255.0;
ifconfig wlan0 192.168.0.21;
ifconfig wlan0 up;
only i don't know how can i setup my gateway...
 
Old 05-11-2008, 04:15 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

If you 'man route';

Quote:
excerpt from 'man route';
example:

route add default gw mango-gw
adds a default route (which will be used if no other route
matches). All packets using this route will be gatewayed
through "mango-gw". The device which will actually be used for
that route depends on how we can reach "mango-gw" - the static
route to "mango-gw" will have to be set up before.
Everything is in the 'man route', 'man' is your friend.


Code:
~#route add default gw 192.168.0.1   # change to your IP
Code:
~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    1      0        0 eth0
BTW, it's 'wireless'.

Last edited by onebuck; 05-11-2008 at 04:16 PM. Reason: wireless
 
Old 05-12-2008, 09:38 AM   #3
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by onebuck View Post
Hi,

If you 'man route';



Everything is in the 'man route', 'man' is your friend.


Code:
~#route add default gw 192.168.0.1   # change to your IP
Code:
~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    1      0        0 eth0
BTW, it's 'wireless'.
i have tried with it, but if i add gateway 192.168.0.1 and netmask 255.255.255.0 it says that it is imposible to add that netmask to 192.168.0.1
 
Old 05-12-2008, 07:45 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Post the output of 'route -n' and 'ifconfig -a'.
 
Old 05-13-2008, 06:34 PM   #5
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
here it is:

ifconfig:

Code:
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          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)

wlan0     Link encap:Ethernet  HWaddr 00:0e:2e:e5:56:bd  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20e:2eff:fee5:56bd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:468 (468.0 B)
          Interrupt:17 Memory:fa100000-fa110000
route:

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
 
Old 05-13-2008, 09:14 PM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

You have not defined a gateway. No gateway in your routing table.
 
Old 05-14-2008, 09:30 AM   #7
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
yeah i know, how can i delete:

Code:
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
i have red man but it won't :P
 
Old 05-14-2008, 10:10 AM   #8
LordAnta
Member
 
Registered: Apr 2008
Location: Munich, Germany
Distribution: Slackware current
Posts: 128

Rep: Reputation: 18
just type as root in a konsole:

Code:
 route add default gw 192.168.0.1                 # this is to add the gateway
 echo "nameserver 192.168.0.1" > /etc/resolv.conf # this is to add the DNS to use
But, instead of setting the IP manually, why dont't you use dhcp??
Replace
Code:
 ifconfig wlan0 netmask 255.255.255.0;
 ifconfig wlan0 192.168.0.21;
 ifconfig wlan0 up;
with
Code:
  ifconfig wlan0 up
  dhclient wlan0

Last edited by LordAnta; 05-14-2008 at 10:13 AM.
 
Old 05-14-2008, 11:57 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,
Quote:
Originally Posted by n0p.cracker View Post
yeah i know, how can i delete:

Code:
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
i have red man but it won't :P
You should read the 'man route';

Quote:
~# man route

excerpt from 'man route'

DESCRIPTION
Route manipulates the kernel's IP routing tables. Its primary use is
to set up static routes to specific hosts or networks via an interface
after it has been configured with the ifconfig(8) program.

When the add or del options are used, route modifies the routing
tables. Without these options, route displays the current contents of
the routing tables.

OPTIONS
-A family
use the specified address family (eg `inet'; use `route --help'
for a full list).

-F operate on the kernel's FIB (Forwarding Information Base) rout-
ing table. This is the default.

-C operate on the kernel's routing cache.

-v select verbose operation.

-n show numerical addresses instead of trying to determine symbolic
host names. This is useful if you are trying to determine why
the route to your nameserver has vanished.

-e use netstat(8)-format for displaying the routing table. -ee
will generate a very long line with all parameters from the
routing table.

del delete a route.

add add a new route.
For a add or del;
Code:
route add default gw 192.168.0.1
route del default gw 192.168.0.1
Edit: I would suggest that you use the DNS provided by your ISP. You can add a third level as a fall back.

Code:
4.2.2.1        #Verizon third level DNS
4.2.2.2
4.2.2.3
4.2.2.4
Just ad these or at least one of them as another DNS in your '/etc/resolv.conf' file. Place them below other DNS if you want the top level DNS to be addressed first.

Last edited by onebuck; 05-14-2008 at 12:01 PM. Reason: resolv suggestions.
 
Old 05-14-2008, 04:51 PM   #10
iiv
Member
 
Registered: Jun 2007
Location: Russia, Moscow Region
Distribution: Slackware
Posts: 167

Rep: Reputation: 30
Please, forget about ifconfig and route, use iproute2(/sbin/ip). By the way it's syntax is much more handy.
 
Old 05-14-2008, 06:52 PM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,
Quote:
Originally Posted by iiv View Post
Please, forget about ifconfig and route, use iproute2(/sbin/ip). By the way it's syntax is much more handy.
You do as you wish but I will continue with route and ifconfig. I do use IP but most newbies don't. I'm comfortable with using the basic command sets with a newbie.

The syntax is not really handy but semantically easier once you use it and search through the reference(s).
 
Old 05-16-2008, 10:32 AM   #12
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
ok, thx to all, i have done it
 
Old 05-16-2008, 01:51 PM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by n0p.cracker View Post
ok, thx to all, i have done it
Please post how you solved the problem so as to assist someone else who may search and find this thread.
 
Old 05-16-2008, 05:35 PM   #14
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
first i have removed all what i had in route, and just added new one default gateway, here is the script

iwconfig wlan0 essid MICRO-PROCESS.BRIBIR;
iwconfig wlan0 channel 11;
iwconfig wlan0 key s:[my key];
ifconfig wlan0 netmask 255.255.255.0;
ifconfig wlan0 192.168.0.21;
ifconfig wlan0 up;
route add default gw 192.168.0.1;
 
  


Reply



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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
How to setup "NETWORK" in ifcfg-XXX file? stny Linux - Networking 1 04-06-2006 05:32 AM
"mythtv-setup" giving "Session management error: Authentication Rejected" Mitchua Ubuntu 0 10-09-2005 04:32 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:47 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration