Showing posts with label OpenWRT. Show all posts
Showing posts with label OpenWRT. Show all posts

Thursday, November 22, 2012

OpenWRT - miniDLNA Server

Install folowing packages
# opkg install minidlna
# opkg install luci-app-minidlna
Edit /etc/config/minidlna
# vi /etc/config/minidlna
config minidlna 'config'
        option port '8200'
        option inotify '1'
        option notify_interval '900'
        option serial '12345678'
        option model_number '1'
        option root_container '.'
        option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg'
        option interface 'eth0,wlan0'
        option friendly_name 'My DLNA Server'
        list media_dir 'media_dir=A,/home/dlna/audio'
        list media_dir 'media_dir=P,/home/dlna/picture'
        list media_dir 'media_dir=V,/home/dlna/video'
        option db_dir '/home/minidlna/db/'
        option log_dir '/home/minidlna/log/'
        option enabled '1'
Make sure miniDLNA run everytime router booting
 # /etc/init.d/minidlna enable
Start miniDLNA using this command
# /etc/init.d/minidlna start
Use this command to force scan your DLNA server
# /usr/bin/minidlna -f /tmp/minidlna.conf  -d -R
To stop miniDLNA using this command
# /etc/init.d/minidlna stop
Now Open windows Media Player and browse to your DLNA server.




My miniDLNA Setting




OpenWRT - Proftp Server

Install Proftp server
# opkg install proftpd
Edit /etc/proftpd.conf
# vi /etc/proftpd.conf
ServerName "ProFTPD Server" ServerIdent on "FTP Server ready." ServerType standalone DefaultServer on DefaultAddress 127.0.0.1 RequireValidShell off Port 21 UseIPv6 off Umask 022 MaxInstances 10 User nobody Group nogroup AuthUserFile /etc/passwd DefaultRoot /home AllowOverwrite on MaxClients 10 MaxClientsPerHost 10 MaxClientsPerUser 10 MaxHostsPerUser 10 DeleteAbortedStores on UserAlias anonymous ftp
Adding new user for ftp account by editing /etc/passwd, in my case i added user openwrt, copy paste configuration from user ftp, but change user ID number and group name.
# vi /etc/passwd-
root:$1$nvFplbd8$l05HR0mdTHcGprNaMg8QA1:0:0:root:/root:/bin/ash daemon:*:1:1:daemon:/var:/bin/false ftp:*:55:55:ftp:/home/ftp:/bin/false network:*:101:101:network:/var:/bin/false nobody:*:65534:65534:nobody:/var:/bin/false openwrt:*:65538:55:openwrt:/home:/bin/false
Adding password for user openwrt
# passwd openwrt
Enabling proftpd service upon start
# /etc/init.d/proftpd enable
To start proftpd service
# /etc/init.d/proftpd start
To stop proftpd service
# /etc/init.d/proftpd stop
Now start proftpd for debug and access it using ftp client and see if any errors
# proftpd -n -d 10
If everything ok, you should see something similar with this picture when accessing proftpd server


Done

OpenWRT - Samba Server

Install samba36-server and luci-app-samba
# opkg install samba36-server
# opkg install luci-app-samba
Edit /etc/config/samba
# vi /etc/config/samba
config samba
        option name 'OpenWrt'
        option workgroup 'WORKGROUP'
        option description 'OpenWrt'
        option homes '0'

config sambashare
        option name 'dlna'
        option read_only 'no'
        option users 'diantokam'
        option create_mask '0777'
        option dir_mask '0777'
        option path '/home/dlna'
        option guest_ok 'yes'

config sambashare
        option name 'hidden$'
        option users 'diantokam'
        option read_only 'no'
        option create_mask '0777'
        option dir_mask '0777'
        option path '/home/old'
        option guest_ok 'yes'
Edit /etc/passwd and add user diantokam,copy paste user nobody configuration, leave everything same as user nobody, except for user ID and group name.
# vi /etc/passwd
root:$1$nvFplbd8$l05HR0mdTHcGprNaMg8QA1:0:0:root:/root:/bin/ash daemon:*:1:1:daemon:/var:/bin/false network:*:101:101:network:/var:/bin/false nobody:*:65534:65534:nobody:/var:/bin/false diantokam:*:65535:65534:diantokam:/var:/bin/false
Create password for user diantokam
# passwd diantokam
Adding diantokam to samba user
# smbpasswd -a diantokam
Enable samba service on startup
# /etc/init.d/samba enable
To start samba service
# /etc/init.d/samba start
To stop samba service
# /etc/init.d/samba stop
To accesses samba share from windows type \\samba_server_name on address bar, in my case it is \\openwrt



or using  \\ip_address in my case, it is \\192.168.1.1



and insert username and password for diantokam that you give for smbpasswd



Done.

Wednesday, November 21, 2012

OpenWrt Attitude Adjustment (Trunk) Exrootfs (Jail Break)

First, plug your external drive to linux and follow this step. Update your packages database
$ opkg update
   Downloading http://192.168.77.246:8080/Packages.gz.
   Inflating http://192.168.77.246:8080/Packages.gz.
   Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Install following package
$ opkg install kmod-usb-core # Kernel support for USB
$ opkg install kmod-usb2 # Kernel support for USB2 (EHCI) controllers
$ opkg install kmod-usb-ohci #Kernel support for USB OHCI controllers
$ opkg install kmod-usb-storage #Kernel support for USB Mass Storage devices
$ opkg install block-mount
$ opkg install kmod-fs-ext4 # Kernel module for the filesystem with which you formatted the partition you want to mount
$ opkg install fdisk # utility to create partitions table
To install package, you can always you this syntax
$ opkg install package_name
Before you step forward, you must prepare your disk partition, i choose fdisk for creating partition table, and i make 3 partition table, two partitions for my data and one for swap file. you can see here for instruction using fdisk. Now, it is time to create filesystem on it, i choose ext3.
$ mkfs.ext3 /dev/sda1 for my data
$ mkfs.ext3 /dev/sda2 for my openwrt rootfs
$ mkswap /dev/sda3 for swap
Next step is create mount point and edit /etc/config/fstab, so every time you restart router, everything back as before :D
$ mkdir -p /home --> mount point /dev/sda1
$ mkdir -p /mnt/rootfs --> mount point /dev/sda2
Editing /etc/config/fstab, my fstab file looks like this
$ vi /etc/config/fstab
config global 'automount'
        option from_fstab '1'
        option anon_mount '1'

config global 'autoswap'
        option from_fstab '1'
        option anon_swap '0'

config mount
        option target '/home'
        option device '/dev/sda1'
        option fstype 'ext3'
        option options 'rw,sync'
        option enabled '1'
        option enabled_fsck '0'
 
config mount
        option target '/mnt/rootfs'
        option device '/dev/sda2'
        option fstype 'ext3'
        option options 'rw,sync'
        option enabled '1'
        option enabled_fsck '0'

config swap
        option device '/dev/sda3'
        option enabled '1'
Reboot it, after reboot check your mount point
$ df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.1M    652.0K    436.0K  60% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    14.3M    148.0K     14.1M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3            1.1M    652.0K    436.0K  60% /overlay
overlayfs:/overlay        1.1M    652.0K    436.0K  60% /
/dev/sda1               916.5G    477.8G    392.2G  55% /home
/dev/sda2                97.3M      4.1M     88.1M   4% /mnt/rootfs
Check swap
$free
             total         used         free       shared      buffers
Mem:         29220        24864         4356            0         1660
-/+ buffers:              23204         6016
Swap:        98936          456        98480
Exrootfs - Whole external root (pivot root) Do this on openwrt console
$ tar -C /overlay -cvf - . | tar -C /mnt/rootfs -xf -
$ mkdir -p /tmp/cproot
$ mount --bind / /tmp/cproot
$ tar -C /tmp/cproot -cvf - . | tar -C /mnt/rootfs -xf -
$ umount /tmp/cproot
Reboot After Reboot, check your system mount point and swap memory Before
$ df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.1M    652.0K    436.0K  60% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    14.3M    148.0K     14.1M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3            1.1M    652.0K    436.0K  60% /overlay
overlayfs:/overlay        1.1M    652.0K    436.0K  60% /
/dev/sda1               916.5G    477.8G    392.2G  55% /home
/dev/sda2                97.3M      4.1M     88.1M   4% /mnt/rootfs
After
$ df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  370.4M     15.4M    335.8M   4% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    14.3M     88.0K     14.2M   1% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda2               370.4M     15.4M    335.8M   4% /overlay
overlayfs:/overlay      370.4M     15.4M    335.8M   4% /
/dev/sda1               916.5G    477.8G    392.2G  55% /home
Now you have a lot of space to install any applications :D Enjoy it !!

OpenWRT on TP-Link MR3420 v1.2 (OpenWrt Attitude Adjustment 12.09-beta2)

Here's my experiences using OpenWRT on TP-Link MR-3420, i don't posting detail how to upgrade from TP-Link original firmware to OpenWRT firmware, because i think you should know how to upgrade firmware than continue to configuring your new firmware, don't worry, there is a lot information on the net about upgrading firmware from TP-Link firmware to OpenWRT firmware.

Here what i did with my Router Download Firmware OpenWRT untuk MR3420 versi Attitude Adjustment Versi 12.09-Beta2 For fresh upgrade (from TP-Link to OpenWRT)

openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin
openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin
For system upgrade (from OpenWRT to OpenWRT)
openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-sysupgrade.bin
openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-sysupgrade.bin
My goal is :
1. Create Rootfs on External Storage (Exroot / Jail Break)
2. Having Samba Server on it
3. Also Ftp server
4. And My DLNA server
5. Oh...My 3GS USB Dongle also must be worked on it, and yes, it worked too, even when i used usb hub

And here's my router and StoreJet


Wireless Router TP-Link MR-3420 v1.2.


Transcend StoreJet 1TB


Huawei E173



And Yes, I can have all of it !!