Route with raspian (debian)

Written by pmd - - no comments

I only want to have some process owned by specific users to use the VPN. This means two route table, or more.

Routes

Create a new table "42" for marked packet:

sudo ip rule add fwmark 42 table 42

List all route table:

ip rule list
0:      from all lookup local
32765:  from all fwmark 0x2a lookup 42
32766:  from all lookup main
32767:  from all lookup default

Delete table 42:

sudo ip rule del fwmark 42 table 42

Show "main" table route:

ip route show table main
default via 192.168.1.1 dev wlan0 src 192.168.1.200 metric 303
10.13.0.81 dev tun0 proto kernel scope link src 10.13.0.82
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.200 metric 303

Add a default route in table 42:

sudo ip route add 0.0.0.0/1 via 10.13.0.29 dev tun0 table 42

Delete the default route in table 42:

sudo ip route del 0.0.0.0/1 via 10.13.0.29 dev tun0 table 42

You can delete all routes of a specific table:

sudo ip route flush table 42

Copy all route from table main to table 42:

ip route show table main | while read LINE; do sudo ip route add $LINE table 42; done

Transmission on Raspberry Pi 3

Written by pmd - - no comments

Install transmission:

sudo apt-get install transmission-daemon

Start and stop transmission daemon:

sudo /etc/init.d/transmission-daemon start
sudo /etc/init.d/transmission-daemon stop

Edit configuration of transmission (stop transmission first):

sudo nano /etc/transmission-daemon/settings.json
"incomplete-dir": "/home/pi/Downloads/torrents/.incomplete",
"incomplete-dir-enabled": true,
"rpc-password": "write_it_here",
"rpc-whitelist": "127.0.0.1,192.168.1.*",
"umask": 2,

Check your transmission's IP:

To avoid permission issues:

sudo adduser pi debian-transmission
sudo adduser debian-transmission pi
sudo chmod -R 777 /home/pi/Downloads/torrents
sudo chmod -R 777 /home/pi/Downloads/torrents/.incomplete

Transmission How To

OpenVPN on Raspberry Pi 3

Written by pmd - - no comments

Know your IP address:

curl ifconfig.me/ip

Install OpenVPN:

sudo apt-get install openvpn

Know your route before OpenVPN is connected:

route

Copy all necessary conf files in:

/etc/openvpn

Interesting settings:

script-security 2
route-noexec
block-outside-dns
up /etc/openvpn/up.sh
down /etc/openvpn/down.sh

Start openvpn from command line to test if tun0 mounts:

sudo openvpn --config /etc/openvpn/server.conf
ifconfig

To connect to VPN at startup, put conf file in /etc/openvpn. Example: openvpn will connect at startup to VPN1 and VPN2:

/etc/openvpn/vpn1.conf
/etc/openvpn/vpn2.conf

To begin with Raspberry Pi 3

Written by pmd - - no comments

Start raspberry on SSD instead of microSD Card

Raspberry Pi 3B+ MicroSD / SSD Speed Benchmarks
Raspberry Pi Cheap SSD Upgrade Guide
 

Once started

  • Virtual Keyboard:
    • sudo apt-get install matchbox-keyboard
    • sudo apt-get install florence at-spi2-core [link]
  • Configure remote access for SSH and VNC: sudo raspi-config
  • Change pi password: sudo raspi-config
  • "Install" SFTP server: actually already done when activating SSH

Display basic stuff

$ while true; do uptime; vcgencmd get_throttled; vcgencmd measure_temp; vcgencmd measure_clock arm; free -h; echo '-----'; sleep 10; done
throttled=0x0
temp=72.0'C
frequency(45)=1200000000
              total        used        free      shared  buff/cache   available
Mem:          731Mi       297Mi       118Mi        27Mi       316Mi       345Mi
Swap:         2.0Gi       346Mi       1.6Gi
-----
 

Disable IPv6

$ sudo nano /boot/cmdline.txt

You have to add this at the end of the line :

ipv6.disable=1

Example, from this...

console=serial0,115200 console=tty1 root=PARTUUID=fe481079-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles

... to this :

console=serial0,115200 console=tty1 root=PARTUUID=fe481079-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles ipv6.disable=1

And then, reboot the pi and verify with ifconfig command.

Source

How to set headless VNC resolution

Problem illustration I had with following Raspberry Pi OS:

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

In /boot/config.txt:

$ sudo nano /boot/config.txt

I had to edit following line (added in bold):

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d,nocomposite

Source 1 2

Excel tricks

Written by pmd - - no comments

1- Generate a calendar in Excel

Here is how to generate a calendar in Excel. Using Excel 2010 in my case.

In cell B1 (by example), put a date :

01/06/2018

In cell B2 :

=IF(
MONTH(DATE(YEAR(B$1);MONTH(B$1);CELL("row";B2)-CELL("row";B$1)))=MONTH(B$1);
DATE(YEAR(B$1);MONTH(B$1);CELL("row";B2)-CELL("row";B$1));"")

Then you just have to drag-n-drop down and right (or left).

To highlight saturdays and sundays :

=IF(ISBLANK(B2)=FALSE;OR(IF(WEEKDAY(B2)=7;TRUE;FALSE);IF(WEEKDAY(B2)=1;TRUE;FALSE));FALSE)

Here is the result :<image>

2- Number of days in one month

Put a date in cell B1. Then in another cell, formula is :

=DAY(DATE(YEAR(B1);MONTH(B1)+1;0))

It will return the number of days of the month in cell B1.

How to install Transmission on WNR3500L

Written by pmd - - no comments

How to set up Optware on WRT3500L with firmware Tomato Firmware 1.28.0000 MIPSR2-138 K26 USB miniVPN by shibby.
How to install Transmission BitTorrent client on external drive plug on USB of WNR3500L. 

First, you should have a partition in ext2/ext3 in order to be able to install Optware on it (you cannot install optware directly on you router memory neither on FAT and NTFS partitions). 

In administration interface of your router, go to section "USB and NAS >> USB Support". Make sure ext2/ext3 File Systems Support is checked.

I plugged in my router one HDD of 250GB. 249GB formatted in NTSF. 1GB formatted in ext3 called <harddisk label> where I will install different packages such as Transmission.

Procedure:
1. make sure mounted usb harddisk is detected. ls /tmp/mnt/<harddisk> should be present
2. cd /tmp/mnt/<harddisk>
3. mkdir /tmp/mnt/<harddisk>/opt
4. mount -o bind /tmp/mnt/<harddisk>/opt /opt
5. cd /opt
6. install your optware, sh /usr/sbin/optware-install.sh
7. update optware, ipkg update and ipkg upgrade
8. install transmission, ipkg install transmission
9. you can list all packages available with ipkg list

Then, go enable BitTorrent in router adminitration, section "USB and NAS >> BitTorrent Client".

Once it's started you can monitor Transmission via http :

Et voila !

Connect to ftpperso.free.fr from anywhere

Written by pmd - - no comments

French ISP provides free website hosting.To enjoy this service, you must be in France to connect to FTP server ftpperso.free.fr.

If you are not in France, find a proxy located in France :
https://hidester.com/fr/listeproxy/

Then in FileZilla, go to Edit >> Settings >> Connection >> FTP >> Generic proxy. Then configure. You might need to test different proxy...

 

Besides that :

  1. create specific ".htaccess" file to activate PHP5.
  2. create folder "sessions" in root folder to be able to use sessions.

 

DDNS on WNR3500L

Written by pmd - - no comments

How to set up DDNS on WRT3500L with firmware Tomato Firmware 1.28.0000 MIPSR2-138 K26 USB miniVPN by shibby.

Two services in case one falls :

  • no-ip.com
  • dtdns.com

In block named Dynamic DNS, I choose Use external IP checker because I do not get my Internet connection from my WAN port. 
I set auto-refresh at 1 day even though I'm not sure what it really means.

How to use no-ip :

  1. create free account on no-ip.com.
  2. choose No-IP.com as service in Dynamic DNS 1 options and configure. 

How to use dtdns :

  1. create free account on dtdns.com
  2. read https://www.dtdns.com/dtsite/updatespec
  3. choose Custom URL as service in Dynamic DNS 2 options and configure. 
  4. example : http://www.dtdns.com/api/autodns.cfm?id=username.dtdns.net&pw=password

It works like a charm !

How to double check from command line ? Here :

# wget -qO- ifconfig.co
Rss feed of the articles