Saturday, November 22, 2008

Making a pretty Bash prompt

Stick this line in ~/.bashrc
PS1="\n\[$(tput setaf 3)\](\u) \[$(tput setaf 1)\]\W \[$(tput setaf 3)\]---> \[$(tput setaf 2)\]"

and bingo!

(spud) / ---> cd home/

(spud) home ---> ls
sapi51 spud

Thursday, November 13, 2008

Little things:Sound, Mount HDD etc

Sound
To make sound work,
  • go into alsamixer
  • Go to playback panel (use TAB if need be)
  • Make sure Master and PCM are nonmute & nonzero

Now test it:
paplay /usr/share/sounds/alsa/Front_Center.wav
aplay /usr/share/sounds/alsa/Front_Left.wav
speaker-test -c2 -Ddefault -twav
To get mic recoding into audacity
amixer set "Capture" cap
amixer set "Capture" 0
alsactl store
or
alsamixer -V capture
hit space on the capture thingy to turn it ON
alsactl store
To stop mic feedback, go into alsamixer and mute (press M) the MIC channel on the 'Capture' panel (hit tab to switch between panels)

Mount / UnMount HDD
# finds what the HDD is called
sudo fdisk -l

# unmount before mount
sudo umount /mnt/SamHDD

sudo mount -t ntfs /dev/sdc1 /mnt/SamHDD -o force
Mount ISO (so Wine can read it)
mount -o loop your.iso /mnt/X
.

wine /home/spud/.wine/drive_c/Program\ Files/Nuance/NaturallySpeaking10/Program/natspeak.exe 2>&1 | uniq -c

spud@spud-laptop:~$ ps -A | grep 'notepad'
8503 ? 00:00:05 notepad.exe
spud@spud-laptop:~$ kill 8503

set WINEDEBUG=+all
wine ./natspeak.exe 2>&1 | grep -F RegisterHotKey

history | tail -n 20

mount -o loop ~/Desktop/Dragon/DNS_v10_Preferred__UltimateNoobFighterz.Release/Dragon_NaturallySpeaking_Preferred_10_ENGLISH_original_DVD1.iso/Dragon_NaturallySpeaking_Preferred_10_original_no-serial/Dragon_NaturallySpeaking_Preferred_10.iso /mnt/DragISO

Colors!
PS1="\[$(tput setaf 1)\]\u@\h \W $ \[$(tput setaf 2)\]"

Tuesday, November 11, 2008

Getting Size of Folders in Linux

I often need to know which folders are eating up all my HDD space. So I spent the day pestering the lovely people on irc.freenode.net, and ended up with this bash script:

#!/bin/bash

# DirectorySize : Lists the size of folder and all
# subfolders, biggest first
# Author: Ohmu (sunfish7 dot gmail dot com)
# 11 Nov 08

# Thankyou to
# irc.freenode.net#linux
# irc.freenode.net#awk
# http://awk.freeshell.org/FormatFileSizes
#
# Example use:
#
# spud@spud-laptop:~$ ./dsize
# 4G .
# 3G .local
# 115M .cache
# 3M .thumbnails
# 1M .fr-6Q0eny
# 560K .gnome2
# 46K .purple
#
# TODO:
# Make it operate on a param (eg dsize /tmp)
# Make it recursive. So that if any folder reports more
# than (say) 1Meg, we go into that folder and rinse&repeat
# eg
# $./dsize -depth 0 (infinite) -granularity 1M
# 4G .
# 3G .local
# 2.9G .local/fish
# 3M .local/pudding
# etc
# anyone interested? :) I'm done for now! RSI'd out!
# Ohmu

# Get the byte usage for each subfolder, including .
# Need some tricky syntax to get the .Whatever folders
# Try 'echo {a,b}c' then 'echo {,.}*'
# [!.] takes out . and ..
# We want . so we have to put it in manually
# Sort, largest first
# The awk script replaces eg 4784 with 4K
#

du -s {,.}[!.]* . \
| sort -rn \
| awk '
BEGIN {
u[0]="K"
u[1]="M"
u[2]="G"
}
{
# Get filesize and filename from paramlist
# cannot use $1 and $2 as filename may contain spaces

size=$1 # grab the number
sub(/^[^\t]+\t+/, "") # Remove it (+ spaces) from param list
name=$0 # what is left is the name

for (i=3; i>=0; --i)
{
if ( size > 1024 ^i)
{
# can sub %d with eg %.2f instead for 2dp precision
printf "%d%s \t %s \n", (size / 1024^i), u[i], name
next
}
}
}' \
| more
Just save it as dsize, and chmod u+x dsize, and mv it into some folder bash will find (echo $PATH)

Tuesday, November 4, 2008

Creating a Wireless Access Point in Ubuntu

I'm getting my wireless internet through a USB Wireless Modem (Tata Indicom CDMA 1xUSB MODEM).

I wanted to share my internet with my 2 housemates. We all have wireless cards built into our laptops. I'm running Ubuntu (Heron).

Well, it took a lot of pissing around. But I got there (thanks to #linux on irc.freenode.net especially LV). I had to edit these files:
/etc/dhcp3/dhcpd.conf
/etc/network/interfaces
/etc/default/dhcp3-server
/etc/sysctl.conf
/etc/rc.local

The first problem was that my wireless card wasn't reporting an IP. Some fiddling with /etc/network/interfaces was needed:

/etc/network/interfaces
When a signal hits our wireless card, we need to know (1) how to report this to the OS, and (2) what to send to the alien machine.
# Remember to do:
# /etc/init.d/networking restart
# after making changes.

auto lo
iface lo inet loopback

auto wlan0
#allow hotplug wlan0 <-- dont know what this does
iface wlan0 inet static
wireless-mode master
wireless-essid spoink
network 10.1.2.0
netmask 255.255.255.0
address 10.1.2.1
broadcast 10.1.2.255
Say some machine comes within range. It's 'Search Wireless Networks' util will send out a blip, and we'll reply 'yo! This is the 'spoink' network!

network and netmask go together. With this setting, we could have 255 computers on the network. When they connect, my box would serve them a random IP 10.1.2.x. This idea of my computer 'serving' IPs is called DHCP. We'll get to that later.

Did I say 255? I mean 254. Because my computer has to have an IP! I've given it address 10.1.2.1

err.. Make that 253 - we reserve a special ip: any packet sent to 10.1.2.255 gets broadcast to every machine on the network.

Now, as the file says, remember to do /etc/init.d/networking restart. Hopefully it'll give [OK]. Now check:
spud@spud-laptop:~$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:05:3c:04:10:74
inet addr:10.1.2.1 Bcast:10.1.2.255 Mask:255.255.255.0
inet6 addr: fe80::205:3cff:fe04:1074/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:4703 (4.5 KB)
Interrupt:11
Excellent!

/etc/dhcp3/dhcpd.conf
So we're going to run a DHCP server.
# Remember to do:
# /etc/init.d/dhcp3-server restart
# after making changes.

# Set DHCPD to answer requests on the wireless interface
# ie if some computer sends a request to this one via wlan0,
# we want DHCP to handle it
# --------------
DHCPDARGS=wlan0;

# Set some defaults for lease time and DNS update method
# --------------
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;

# these must match what we set up in /etc/network/interfaces
# this machine is acting as a router
# --------------
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.2.255;
option routers 10.1.2.1;

# Set the Name Server address. If we were running DNS on this machine,
# this would be the same as our WLAN0 address (ie 10.1.2.1)
# As I haven't figured out DNS yet, I just look at my internet connection log
# --> Pid of pppd: 6162
# --> Using interface ppp0
# --> local IP address 219.64.73.18
# --> remote IP address 172.23.129.14
# --> primary DNS address 203.197.12.30
# --> secondary DNS address 202.54.1.18
#
# ... and use the DNS addresses it gives
#
# This is a really shoddy method - if the DNS changes suddenly my housemates
# will be scuppered. eg say they request www.google.com.
# It's the DNS (Domain Name Server)'s job to convert this into an IP eg 4.56.74.121,
# but if I have an obsolete IP for the DNS server, ...
# --------------
option domain-name-servers
203.197.12.30,
202.54.1.18;

# Allocate a network range for dynamic IP addresses to hand out to clients.
# in /etc/network/interfaces we set the network and mask.
# Now we can restrict further
# I'm allowing a max of 10 simultaneous connections
# --------------
subnet 10.1.2.0 netmask 255.255.255.0
{
range
10.1.2.10
10.1.2.19;
}
OK I hope I commented that severely enough. Now, as it says, you need to do /etc/init.d/dhcp3-server restart, ... it should give you an [ok]

Wait, .. you should probably stick this in first:

/etc/default/dhcp3-server
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".

INTERFACES="wlan0"
OK - nearly there! Final step is IP forwarding. Have a look at my IRC conversation with LV below, to get the gist.

/etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# SAM - I uncomented this!
/etc/rc.local
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o ppp0 -j MASQUERADE

exit 0
You're probably best off restarting everything at this point:
/etc/init.d/networking restart
/etc/init.d/dhcp3-server restart
Finally, here's an entire conversation I had with LV, who picked up on my floundering on irc.freenode.net#ubuntu: It is mainly thanks to him I have this working. He is lucid. I'm going to keep occasionally reading through this conversation until I understand it all!

I can prolly help

awesome!
I'm confused by this line:

# Set the router address, this will be 10.x.x.1, the address
# of your wireless interface WLAN0
option routers 10.1.2.1;

this is kinda a total mess

ifconfig says I don't have an IP for my WLAN0
yes. I'm _so_ confused
I've got a dozen guides that don't work, and about 5 people have helped me for a few mins then run off ;)

and I haven't seen a route table yet
which network is the wireless?
ah.
ok
type route -n
i don't mind if you paste that in irc
it shouldn't be that long

ya private chans shud be ok for posts

spud@spud-laptop:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.23.129.14 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
spud@spud-laptop:~$

OK, how much do you understand about what you're trying to do?
well I'm determined to get my head round it
but I've had to look up things like 'gateway' and 'dhcp' on wikipedia
I think I get all the basic concepts
I just cant get them all together

I think you're probably right about needing your dhcp server set up
OK, first problem:
no IP on wlan0
what linux?
ubuntu?
heh I forgot what channel I was in :)
yeah!

BASICS
ok i'll go through it slowly:
each INTERFACE
has an ADDRESS
that is on a NETWORK
when you send a TCP/IP packet, the system sez:
is this destination ADDRESS on the same NETWORK?
if NOT
send it to the GATEWAY
all clear?
and the ROUTE to the gateway is through the INTERFACE
and INTERFACE is link: ppp0, lan0, etc.

yep got just that far off wp. question: does the system look thru all interfaces doing this for each?

depends on the route table
because the routing is simplest match:
do I know about the specific network listed? if not, send to DEFAULT GATEWAY
now
your machine has to:
have an address on wlan0
have a dhcp server (that's DYNAMIC HOST CONFIGURATION PROTOCOL, or, how to hand out IP addresses)
you say ppp0 is your upstream?
still there?

yes, thats where I get my internet from. its a usb wireless modemmy thing

ok sweet.
well: pick a network for the wireless clients. I see you're already comfy w/ 10.x.x.x networks
you'll assign .1 to wlan0

ya I copied it from the guide. so I'll stick.

which I'm pretty sure is done w/ /etc/default/interfaces
* Ohmu checks

yeah that's where I'd do it.

hm I think I need to rewrite my interfaces file
Is /etc/network/interfaces the same deal?

AND, the interfaces entry needs to be the whole kaboodles
yes
that's what I meant

k
I have this:

auto lo
iface lo inet loopback
#iface wifi0 inet dhcp
#auto wlan0
iface wlan0 inet static
wireless-mode master
wireless-essid spoink
address 192.168.2.1
network 192.168.2.0
netmask 255.255.255.0
broadcast 192.168.2.255

that all looks good

I just change the ips to 10.x.x.x stuff right?

now we need to set up dhcp on that interface. altho I'd like to know why there isn't an IP on wlan0 after that
yes
just pick a top level: 10.0.2.x, or 10.1.2.x or whatever, but then make all the machines a .x
(that's what the netmask bit is about)

iface wlan0 inet static ... is good? don't need to /s/static/dhcp?

no. in fact...
if you say dhcp in interfaces, then you're ASKING for an address
in this case, you're about to be TELLING
now: questions about dhcp I have are, what interface is it bound to, and what does the log say?
sounds like you already have attempted to setup dhcp server

ok so I'm saying to my wireless card 'You ARE 10.0.0.1' so the other wifi machines will see this ip right?

yes
but in order to do so... they need an IP
so the connect via wireless "WIRE"
then say: "HEY I NEED AN IP"
and then your machine sez: "TAKE THIS"
and then it is on the network

right, my dhcp server hands them an ip

yes

address 10.5.5.0
network 10.5.5.0
netmask 255.255.255.0
broadcast 10.5.5.255
is this ok?
whats the diff between address and network?

nope
wronte network
wrong network
ok:
do you know binary?

ya

ok, IP is 4 bytes
netmask is AND bitmask against address, to get network (network = address & netmask)
so:
255.255.255.0 == 1111111 1111111 1111111 00000000
so I say: 10.0.0.14 && FF FF FF 00, and get 10.0.0.0 same network
you have this on a different network, 10.5.5.0
you need: 10.0.0, whatever you put in interfaces file
same network
same 1st 3 octets
oh I see, the software will do this && on packets to determine if they're for the same netweork

(that's 8 bits)
YES
and if they are NOT, they transmit to the default gateway
& pass them to default gateway if not
k
IP-Forwarding etc

which is what you are about to become
for the wireless network
aww crap
you might have to masquerade them
hmm
have you seen NAT or MASQ or Masquerade in your guides?
I know NAT is network address table
duno any more than that

no TRANSLATION

ok

have you seen those terms in your "make ubuntu into a wireless AP" guides

no havent got that far I guess

ok don't worry about it, I hope. :)
* Ohmu crosses fingers

it works like this:
if you need more IPs than you got, like 1 from the ISP but several in the house
you have to use NAT to get them all online
and NAT takes a connection from a "non-routeable" address
like 192.168.x.x or 10.x.x.x
and takes the port number, and remembers it. then it rewrites the packet, with a DIFFERENT port number, and the REAL ip address
when the response comes back on that port number, it rewrites it backwards, and replies to the computer behind it
on the unrouteable network
that's NAT
OH! so the packet is {ip, port} ? how many ports can one have?
so each computer gets its own port
2 bytes 64k 0-65535
no
each computer has its own IP address, and 64k ports
each pcaket has SOURCE port, DEST port
so I call google on DEST port 80, SOURCE port 32965 (random)
and then I call google again on DEST port 80, SOURCE port 66545
and don't conflict
so NAT rewrites ports and remembers the rewrites for when replies come back

so... each computer on network has an internal-network-ip, NAT has a table that gives each a corresp port. so network only has one internet-ip.
i gotit

yes, almost.
nat has a table for each port for EACH CONNECTION
it can handle multiple connections per client computer
just like the "real" internet
and otherwise you have it exactly

what do u mean? like if ur getting internet from 2 places at once?

no I mean if you're calling 2 websites at a time
or website + AIM
+skype
etc

oh!! so a single comp on the network might be using a dozen ports, assigned by NAT
?

YES

gotcha

but only when they pass thru the NAT gateway
the source computer picked its own ports and the NAT gateway remembered that, rewrote it, and then fixed it on the way back
i'm worried you might have to NAT the wireless clients
because you certainly can't route their traffic out ppp0

oh!

if you've looked at guides that mention iptables ipfw, etc,

so NAT and DHCP will go together? or i shud use NAT INSTEAD of DHCP?

and they have --dnat or --snat, that's what we're talking about
no,
dhcp does one thing:
gives IP addresses to clients

from a pool, k rmember now

and other stuff like dns server and domain name, ok, but still, it's like an on-boot "here's who you'll be" ticket
which for *clients*, makes sense
SERVERS need to be known in order to be reachable, so they usually have a static address.
but that's what DNS is for
and that's manageable

so its only the DNS server that has a static address right?

well that too
and ? uh do you mean on the wireless network?
no i mean upstream ips
thats the only fixed ip I'll need right?

well, and your ip & gateway
but you should get all of them together
dhcp over ppp :)

oh yes. found it

which is how you got your 178 address

--> pppd: ا[06][08]h�[06][08]
--> local IP address 121.245.8.239
--> pppd: ا[06][08]h�[06][08]
--> remote IP address 172.23.129.14
--> pppd: ا[06][08]h�[06][08]
--> primary DNS address 203.197.12.30
--> pppd: ا[06][08]h�[06][08]
--> secondary DNS address 202.54.1.18
--> pppd: ا[06][08]h�[06][08]
from my modem connection terminalbox

yes
so hmm. we never looked at your dhcp server config
altho there was an obvious error

man I need to buy you beer or something. where do you live?

dunno if you looked at that
heh
portland, oregon

cool :) I'm in india

but I'm running outta steam, so lets look at your configs while I'm still awake
WHOA!
heh

ok lets!

so it's afternoon there?

forgot timelag :/ s brob 2am for u
2.15
pm

yes.
hahah

haha

ok, well your dhcp server ...
when you restart it, what does the log say
?
... open another terminal
sudo tail -f /var/log/daemon.log
then in your first terminal, restart the dhcp-server
and you can alt-tab back to see what happened


spud@spud-laptop:~$ sudo dhcpd3 restart
[sudo] password for spud:
Internet Systems Consortium DHCP Server V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 leases to leases file.
No subnet declaration for restart (0.0.0.0).
** Ignoring requests on restart. If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface restart is attached. **
Not configured to listen on any interfaces!
spud@spud-laptop:~$

oops
/etc/init.d/dhcpd3-restart ?
:)
err dhcp3-server restart
something like that

ah
doh

you just ran the daemon
:)

spud@spud-laptop:~$ sudo /etc/init.d/dhcp3-server restart
* Stopping DHCP server dhcpd3 [fail]
* Starting DHCP server dhcpd3 [fail]
spud@spud-laptop:~$

tail /var/log/daemon.log
spud@spud-laptop:~$ sudo tail -f /var/log/daemon.log
:
Oct 22 14:21:02 spud-laptop dhcpd: For info, please visit http://www.isc.org/sw/dhcp/
Oct 22 14:21:04 spud-laptop dhcpd: Internet Systems Consortium DHCP Server V3.0.6
Oct 22 14:21:04 spud-laptop dhcpd: Copyright 2004-2007 Internet Systems Consortium.
Oct 22 14:21:04 spud-laptop dhcpd: All rights reserved.

hmmmmm
that doesn't look right
i think you need to pastebin your dhcpd.conf file
tail /var/log/messages or /var/log/syslog or /var/log/kern.log for other interesting things

# Sample /etc/dhcpd.conf
# Set DHCPD to answer requests on the wireless interface
DHCPDARGS=wlan0;

# Set some defaults for lease time and DNS update method
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;

# Set the subnet mask for the wireless IP network
option subnet-mask 255.255.255.0;

# Set the Broadcast address. This will be 10.x.x.255,
# the "x.x" will depend upon the network assigned to you by NZWireless.
option broadcast-address 10.1.2.255;

# Set the router address, this will be 10.x.x.1, the address
# of your wireless interface WLAN0
option routers 10.1.2.1;

# Set the Name Server address. This will be the same as your WLAN0 address
# because we intend to run DNS on this machine.
option domain-name-servers 10.1.2.1;

# Set the default domain name for clients on this network.
# i.e. the DNS domain assigned to you by your wireless administrator.
option domain-name "simon.akld.nzwireless.org";

# Allocate a network range for dynamic IP addresses to hand out to clients.
# Again, this range will be in 10.x.x.x, depending upon the network allocated
# to you by your wireless administrator.
#
subnet 10.1.2.0 netmask 255.255.255.0 {
range 10.1.2.10 10.1.2.20;
}

oshit wait
i didnt save it b4 restarting server

heh
so 10.1.2.1 is the address of wlan0?
and i don't recall you saying you restarted wlan0
:)

spud@spud-laptop:~$ sudo tail -f /var/log/daemon.log
Oct 22 14:24:14 spud-laptop dhcpd:
Oct 22 14:24:14 spud-laptop dhcpd:
Oct 22 14:24:14 spud-laptop dhcpd: No subnet declaration for wlan0 (0.0.0.0).
Oct 22 14:24:14 spud-laptop dhcpd: ** Ignoring requests on wlan0. If this is not what
Oct 22 14:24:14 spud-laptop dhcpd: you want, please write a subnet declaration
Oct 22 14:24:14 spud-laptop dhcpd: in your dhcpd.conf file for the network segment
Oct 22 14:24:14 spud-laptop dhcpd: to which interface wlan0 is attached. **
Oct 22 14:24:14 spud-laptop dhcpd:
Oct 22 14:24:14 spud-laptop dhcpd:
Oct 22 14:24:14 spud-laptop dhcpd: Not configured to listen on any interfaces!

(if ifconfig wlan0 doesn't have an address line it didn't work)
ok
your subnet stanza is incomplete

this is my interfaces file
iface wlan0 inet static
wireless-mode master
wireless-essid spoink
address 10.5.5.0
network 10.5.5.0
netmask 255.255.255.0
broadcast 10.5.5.255

ok change to: address 10.1.2.1 network 10.1.2.0 broadcast 10.1.2.255

spud@spud-laptop:~$ ifconfig wlan
wlan0 Link encap:Ethernet HWaddr 00:05:3c:04:10:74
UP BROADCAST MULTICAST MTU:1500 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)
Interrupt:11

ok no address yet
see how the network numbers match?
* Ohmu retries
yeah
iirc x.x.x.0 is reserved

10.1.2.x is your network now. to you, this means the LOCAL LINK of all the wireless on your network that can talk to each other .
and .0 is usually the network number
altho I've seen .128
and .192
etc etc
the smallest network is 252
(which is the same as 0..3, with only 1 & 2 useable, only with 6 of the 8 bits of the network set to 1's)

i see. u mean 255.255.255.252 as netmask?

sure. AND as network, too

i tried got the same fail
and same tail

hmm.
ok

its /etc/dhcp3/dhcpd.conf im editing

your dhcp config file is incomplete
the part between tehe braces is too sparse
ALSO
and the part thats killing you
is the DHCPARGS=wlan0 is NOT sufficient
and it's dying because it wants to see that wlan0 phrased in some other way

?

I mean
it has to say wlan0 somewhere, but DHCPARGS=wlan0 is NOT what it's looking for

its saying no subnet declaration for wlan0. but...
subnet 10.1.2.0 netmask 255.255.255.0 {
range 10.1.2.10 10.1.2.20;
}
is this not a decl for wlan0?

where in that does it say wlan0?

isnt DHCPDARGS=wlan0; setting the default towlan0?

no

how to move?

that needs to go somewhere else, probably

u know? or shud I man dhcpd.conf while ur sleeping :p

:)
that wouldn't hurt
no that kind of directive looks like what goes in /etc/default/foo...
OH!
yes

i'm installing the package on my ubuntu now to give better answers
2 secs

wait

and THERE IT IS: /etc/default/dhcp3-server

the guide i took it from... http://oob.freeshell.org/nzwireless/dhcpd.html

INTERFACES=""
well if it wasn't for ubuntu and india, then it's a guide, not exact instructions
go edit your file

named it as /etc/dhcpd.conf file

yes exactly
and that's the last version anyway
so edit /etc/default/dhcp3-server right now
then restart the server
it will get farther
further
whtaever

but I couldn't find such a file. my closest match was /etc/dhcp3/dhcpd.conf

yes
but there are some differences in the syntax
and your guide might have messed your dhcpd.conf file up too much
did you svae the original, sample conf?

I already did this:
INTERFACES="wlan0 wifi0"

uhh
wlan0 is wireless what's wifi0

god knows I stuck it in for good luck

heh
* Ohmu removes wifi0

it showed up in my iwconfig

well I killed a server today with adding another interface in the wrong set of quotes

:]
odear

yes?

failed the same ... I might have to restart networking or something too?

you still don't have an ip on wlan0
so yeah prolly

spud@spud-laptop:~$ ifconfig wlan
wlan0 Link encap:Ethernet HWaddr 00:05:3c:04:10:74
UP BROADCAST MULTICAST MTU:1500 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)
Interrupt:11
spud@spud-laptop:~$

your subnet stanza should most resemble the one for 10.5.5.0 in the example
but you picked 10.1.2.0
no address
have you looked at dmesg yet?
dmesg | less +G
(press q to quit less when you're done)

last 3 lines say: [16338.506025] ADDRCONF(NETDEV_UP): eth0: link is not ready

that's your ethernet
it's not plugged in
(that's what link not ready means)

just done a :
root@spud-laptop:~# /etc/init.d/networking restart
* Reconfiguring network interfaces... [ OK ]

ok

yeah. im not using my eth

ifconfig wlan0 up
ifconfig wlan0
(got an addy?)

nope
but ifconfig wlan0 up didnt complain

you want to either uncomment "auto wlan0" in interfaces, or else put "allow hotplug wlan0"

any pref?

yes it didn't complain cuz it was already up, but it didn't pick up an addy on the way but it was ok w/ that.
at this point

ive done auto wlan0

yea but on every subnet under the sun :)
but try allow hotplug
and then check the manpage for interfaces, which IIRC is a pretty complete

dood u need to get sleep :)
any chance of picking this up tomorrow?

possibly... i'm up late
and I have had no love on MY ubuntu problems on irc...
but you're on your way

you're the only person who seems both able and willing to help me out on this

I hope I was able to clear up what oyu're actually trying to do a little better

ya I understand a load now I didn't before

if I'm to send you off in a direction, then what you care about is: why doesn't wlan0 get an address, and once that's fixed, can you get dhcp3-server up.

ok great.
mind if I look you up tomoro?

unfortunately, that might mean you've fixed it all the way up to the tricky part: MASQ
aka nat
whatever
they've changed the specs so many times

hehe

it's all the same thing just new programs with new options
which is why I know exactly what I'm trying to do and have no idea how to do it

u been doing this a while?

"it's a learning experience," my mother would say
yeah been doing linux for 10+ years
been doing ubuntu laptop for <30 days

I've been putting it off for 15

heh

but I sold my lappy with the wincd
and all I had was an ubuntu freebie
haha
for my old t30

well I've been saying for about that long, one of these days m$ will do "that one last thing" ... and vista was it
hah I have a t20 right now
I got my t30 for like 20 bucks and nursed it back to life

what kinda sound chip is in that one?
does suspend/resume work?

just changed the mobo cos i blew it up sticking my guitar thru the audio
heh

cuz I really broke my sound and I, the linux guru, have no idea how to fix it
think so
dont know if ive tried

oh

u might need new mobo.. ?

oh i don' tknow about all that
i'm sure it's software
but now it's 2:21am and I have to go to bed now.
:)

big thanks!
I'll eat some food and have a play with this

I'll pop on tomorrow night, earlier, it will be 11:30am your time or so if I do,

sweet

but if we miss each other, good luck!

:)

and god bless you!

you too :)
namaste
<-- LV has quit ("Leaving")

Friday, October 31, 2008

Wireless Internet in India

I'm in Kerala. Internet comes via a Wireless USB Modem. Specifically 'TATA Indicom CDMA 1x USB MODEM'.

To get it up and running, I just needed to 'gedit /etc/wvdial.conf', change it thus (I got this from someone else's blog!):
[Dialer Defaults]
Init = ATZ

[Dialer TATA]
Modem = /dev/ttyACM0
Modem Type = USB Modem
+FCLASS=0
ISDN = 0
Baud = 460800
Phone = #777
Dial Command = ATDT
Init1 = ATZ
Init2 = AT+CRM=1
Username = internet
Password = internet
stupid mode = 1
Linux sees my modem on ttyACM0 - yours may differ.

Now do 'sudo wvdial TATA'

Presto, Internet! It's a bit scrappy - it would be nice to have a flashy internet icon in the tray instead of an ugly terminal. So I installed gnome-ppp. Filling out the boxes with the above info (didn't need all of it), it runs perfectly*!

(*might need a restart)

Thursday, October 30, 2008

VirtualBox - XP and Vista in Ubuntu

Ive been in Linux (flavour = Ubuntu) 3 weeks now. Linux has no continuous speech recognition. I have RSI (hurty hands). I *need* this. XP & Vista have it now. So I've just torrented an XP ISO from here:

Download Unmodified Original Windows XP with SP3 Integrated Full Retail and VL Install CD ISO Image from MSDN/TechNet Plus via HTTP or Torrent » Tip and Trick

..., installed VirtualBox
  • Install dkms
    There's a kernel module vboxdrv that interfaces between the linux kernel and VirtualBox

    (irc.freenode.net#vbox) Oct 29 12:20:19 Ohmu: The DKMS package is indeed something what Dell proposed. This package keeps track of kernel changes and will recompile kernel modules on demand.
    Specifically, it'll recompile vboxdrv.

  • spud@spud-laptop:~$ uname -r
    2.6.24-21-generic
    ... so I have to install package: virtualbox-ose-modules-2.6.24-21-generic

  • Logout, login

  • spud@spud-laptop:~$ /etc/init.d/vboxdrv setup (start?)

  • Run VirtualBox, follow the wizard, specify the ISO as the CD drive, make a shared folder
Amazing, XP installs & is up in a window. I have sound, internet...

www.calvinshub.com/2008/08/25/how-i-removed-the-windows-xp-sp3-activation/


and presto!

Now I want my VirtualXP to see the shared folder
  • Devices -> Install Guest Additions
    (It'll need a reboot)

  • In VirtualXP, Start -> Accessories -> Terminal
    C\Blah> net use x: \\vboxsvr\MyShare
    (... or whatever the name for your shared folder is)
    C:\Blah> x:
    X:\>
Now test it:

x:\> echo wibble > wob

Go back to linux and have a look...

spud@spud-laptop:~/.VirtualBox/Machines/VirtualXP/share$ ls

wob

I'm going to share my external USB hard drive.

spud@spud-laptop:~/.VirtualBox/Machines/VirtualXP/share/SamHDD$ ln -s /mnt/SamHDD


Great! It has write permissions too!

Vista
I have a copy on my portable HDD of the Vista DVD. (not an ISO). By running the setup.exe from XP, I've replaced my XP with Vista.

Install Guest Additions the same way.

Had to look at (VirtualBox)->Devices -> Shared Folders to check the name of the shared folder. Then Windows Explorer -> right-click on Network -> Map Network Drive, and stick in \\vboxsvr\whateveritwas

I did some fannying around clicking stuff in control panel. Turned User Account Control off. Then set public/private network, file-sharing on etc. Don't know if it was needed. Feedback welcome!