Archive for the ‘linux’ Category

Brian Behlendorf at IIIT

Wednesday, December 8th, 2004

Who is Brian
Apache co-founder/developer, VRML developer, Collabnet,Organic Online co-founder. In Open Source movement he stands with Linus and RMS.
He was in India for Linux-Banglore, and happened to visit IIIT Hyderabad.
He gave a talk in IIIT, about how apache was developed from patches. “a-patch-e” . And _something_ on open source. How open source helps in a better project development etc.
After the talk we ( me, Anubhav, Google, Vamsee) escorted him to ITC, where he was giving a press conference. Our job was to clear journilists doubts about technicalities of the talk.
Most important, after the conference was over, we had a chance to sit with Brian, and chat with him. We discussed open source, FreeBSD ( he favoured it ), kernels.

Lucky me smile

quotes -
“apache : a-patch-e”
“Opensource : fame vs money vs satisfaction”
“patent problem : patent on a recepie”
“fedora : good, its now a community project not RH project”
“we don’t write documentation for free smile

linux :: d4x hangs

Sunday, August 15th, 2004

d4x bole to downloader for x “my favourate downloader in linux”
kinda reget.

i was frustoo with d4x, coz of its undetermined behaviour
whenever i use to add a new download and sometimes at random it use to hang
and i didnot really know why so, and thought it as a bug.

but today, suddenly i realized the reason…
“enable sounds - yes”

if some application( xmms mostly) is using audio device it cannot play
sound
and hence use to wait for the device… which seems like it has hanged

so “enable sound - no” in general setup .. solves everything…
d4x rocks


killall -9 killall
http://students.iiit.net/~sunilmohan/

linux:: exporting audio and video

Tuesday, July 13th, 2004

How to export audio and video on GNU/Linux system ?

Suppose you want to export audio/video from system REMOTE (where you are running our application say mplayer), to another system LOCAL (where you want to see it and hear it).
The scenerio is : you are working on system LOCAL. From there you logon to system REMOTE (say using ssh). You want to run mplayer on system REMOTE, and want to watch a movie. And obviously want to hear the audio too.

example : LOCAL = 172.16.7.31 aka inferno and REMOTE = 172.16.10.31 aka matrix

exporting video ( called DISPLAY )
———————————–
you want to open display of REMOTE on LOCAL.
LOCAL should allow REMOTE to open display on LOCAL
For that on LOCAL we do

LOCAL$ xhost +REMOTE_IP
example : [smr@inferno ]$ xhost +172.16.10.31

REMOTE_IP is the ip of REMOTE system
+REMOTE_IP means you are adding REMOTE to the access list of exporting display
* “$ xhost +” means you are allowing eveyone to export display to your system

now you can export display from REMOTE to LOCAL by

REMOTE$ export DISPLAY=LOCAL_IP:0.0
example : [neo@matrix]$ export DISPLAY=172.16.7.31:0.0

LOCAL_IP is the ip of the LOCAL system
:0.0 means the display number of LOCAL system
the default display opened is 0, so works most of the times
if your display is something else then you need to give that ex
LOCAL_IP:2.0 for display 2
* i dont know what does .0 mean (why other 0 after dot)

now you can see the video of mplayer running on REMOTE system on your LOCAL system,

REMOTE$ mplayer movie.avi
example : [neo@matix]$ mplayer The-Matrix.avi

expoting audio ( sound )
————————
unlike display there is no native way of exporting audio
so we export sound using arts, esd, etc, which sends the stream from remote using tcp on some port and is recieved by at the other end at that port, and played.
what audio modules do you have - arts/esd/oss/sdl/etc ??
exporting sound is dependent on what mode you want to use and what modes do you have

using arts
———-

start arts server on LOCAL system, in listening mode on port 5001 ( any port u like)

LOCAL$ artsd -u -n -p 5001
example : [smr@inferno]$ artsd -u -n -p 5001

-u means public => no authentication => dangerous

now export arts sound from REMOTE to LOCAL

REMOTE$ export ARTS_SERVER=LOCAL_IP:5001
example : [neo@matrix]$ export ARTS_SERVER=172.16.7.31:5001

5001 is the port where arts server is running on LOCAL system
while running your application make sure that its using arts as sound output in your appplication (in mplayer we give -ao arts )

REMOTE$ mplayer movie.avi -ao arts
example: [neo@matrix]$ mplayer The-Matrix.avi -ao arts

using esd
———

start esd on LOCAL sysem, in listening mode on port 5001

LOCAL$ esd -public -tcp –port 5001
example: [smr@inferno]$ esd -public -tcp –port 5001

now export esd sound from REMOTE to LOCAL

REMOTE$ export ESPEAKER=LOCAL_IP:5001
example: [neo@matrix]$ export ESPEAKER=172.16.7.31:5001

5001 is the port where esd server is running on LOCAL system
while running your application make sure that its using esd as sound output in your appplication (in mplayer we give -ao esd )

REMOTE$ mplayer movie.avi -ao esd
example: [neo@matrix]$ mplayer The-Matrix.avi -ao esd

Some applications don’t speak esd.So we fools them into talking to esd when they think they’re opening dsp. This is done using esddsp in the following way ( assume your mplayer does not supprt esd )

$ esddsp -v –server=LOCAL_IP:5001 mplayer movie.avi
example: [neo@matrix]$ esddsp -v –server=172.16.7.31:5001 mplayer movie.avi

i don’t know how can sound be exported using other sound systems like oss,sdl etc.

Updated May 05, 2005 : Wow this page is first result on google seach of “exporting audio/video linux” queries smile
Report bugs/errors/feedback to me at smr@thisserver….

linux :: iptables

Tuesday, July 6th, 2004

three important things in iptables are
1) table
2) chain
3) rule
** rules are grouped into chains which inturn are combined into tables
** tables has chains containing rules

table : there are three tables (by default) in iptables
1) nat - on creation of new connection, for NAT (see previous post)
2) mangle - for specialized packet alteration
3) filter - normal chains (kindof firewall stuff)

chain: collection of rules
1) OUTPUT - any packet going out of the system goes through OUTPUT chain
2) INPUT - any packet coming into the system goes through INPUT chain
3) FORWARD - any packet routing through the system goes through FORWARD chain. that is destination ip is not the systems ip, nor it is generated from this pc, but this system is gateway for the source system.
4) PREROUTING - seen by a packet as soon as it enters the system, before it reach INPUT. not for filter table
5) POSTROUTING - last chain a packet goes through, before it leaves. after OUTPUT. not for filter table.

rules: that applies to the packet
1) ACCEPT
2) DROP
3) QUEUE
4) RETURN

other important things about iptables are -t , -A (INPUT/ OUTPUT/ FORWARD), –states (NEW/ ESTABLISHED/ RELATED/ INVALID), -p (tcp/udp/icmp/all), -m (state), -i , -o

lets see how do i use all this.
iptables -t TABLE_NAME=( nat/ mangle/ filter ) -A/D CHAIN_NAME=( INPUT/ OUTPUT/ FORWARD ) -s SRC_IP -d DEST_IP -m MODULE=( state/ tos/ tcp ) –state STATE=( NEW/ ESTABLISHED/ RELATED/ INVALID ) -p PROTOCOL=( tcp/udp/icmp/all ) –sport SRC_PORT –dport DEST_PORT -i INPUT_INTERFACE -o OUTPUT_INTERFACE -j RULE=( ACCEPT/ DROP/ QUEUE/ RETURN )/ SNAT/ DNAT/ MASQUERADE/ CHAIN

better see example commands and try out few
-A INPUT -p icmp -j ACCEPT
-A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s ANY_IP -i eth0 -p tcp -m tcp -j ACCEPT
-A FORWARD -i eth1 -p tcp -m tcp –dport ssh,http,smtp,pop -j ACCEPT