How to Add Route in Linux

In the 1st part of the IP Routing series, we learned the fundamentals of Linux IP Routing.

Route command is used to show/manipulate the IP routing table. It is primarily used to setup static routes to specific host or networks via an interface.

In this article we will see how to manipulate the routing tables in Linux using route command.

We’ll first explain how routing is done with some basic route command examples, and then we’ll explain using a sample network architecture about how to setup routes in your network.

I. How Routing is Done?

1. Display Existing Routes

route command by default will show the details of the kernel routing table entries. In this example, the ip-address of the system where the route command is being executed is 192.168.1.157

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

The above command shows that if the destination is within the network range 192.168.1.0 – 192.168.1.255, then the gateway is *, which is 0.0.0.0.

When packets are sent within this IP range, then the MAC address of the destination is found through ARP Protocol and the packet will be sent to the MAC address.

If you don’t know what ARP is, you should first understand how ARP protocol works.

In order to send packets to destination which is not within this ip range, the packets will be forwarded to a default gateway, which decides further routing for that packet. We will see this shortly.

By default route command displays the host name in its output. We can request it to display the numerical IP address using -n option as shown below.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.10    0.0.0.0         UG    0      0        0 eth0

2. Adding a Default Gateway

We can specify that the packets that are not within the network has to be forwarded to a Gateway address.

The following route add command will set the default gateway as 192.168.1.10.

$ route add default gw 192.168.1.10

Now the route command will display the following entries.

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
default         gateway.co.in   0.0.0.0         UG    0      0        0 eth0

Now we have just added a default gateway to our machine. To verify whether it is working properly, ping some external host (for example, google.com) to send ICMP packet.

$ ping www.google.com

The following is the sequences of evets that happens when the above ping command is executed.

  1. First it will query the DNS server to obtain the ip-address of google.com ( for example: 74.125.236.34 )
  2. The destination address ( 74.125.236.34 ) is not within the network range.
  3. So, in Layer-3 (IP header) the DESTINATION IP will be set as “74.125.236.34”.
  4. In Layer-2, the DESTINATION MAC address will be the filled in as the MAC address of the default gateway ( 192.168.1.10’s MAC ). The MAC will be found by using ARP as described earlier.
  5. When the packet is sent out, the network switch ( which works on Layer-2 ), send the packet to the default gateway since the destination MAC is that of the gateway.
  6. Once the gateway receives the packet, based on its routing table, it will forward the packets further.

The above 2 examples would have given a good idea about how routing is done within a network. Now we will see other command line options available with route command.

3. List Kernel’s Routing Cache Information

Kernel maintains the routing cache information to route the packets faster. We can list the kernel’s routing cache information by using the -C flag.

$ route -Cn
Kernel IP routing cache
Source          Destination     Gateway         Flags Metric Ref    Use Iface
192.168.1.157   192.168.1.51    192.168.1.51          0      0        1 eth0
192.168.1.157   74.125.236.69   192.168.1.10          0      0        0 eth0
.
.
.

4. Reject Routing to a Particular Host or Network

Sometimes we may want to reject routing the packets to a particular host/network. To do that, add the following entry.

$ route add -host 192.168.1.51 reject

As you see below, we cannot access that particular host (i.e .51 host that we just rejected).

$ ping 192.168.1.51
connect: Network is unreachable

However we can still access other hosts in the network (for example, .52 host is still accessible).

$ ping 192.168.1.53
PING 192.168.1.53 (192.168.1.53) 56(84) bytes of data.
64 bytes from 192.168.1.53: icmp_seq=1 ttl=64 time=7.77 ms

If you want to reject an entire network ( 192.168.1.1 – 192.168.1.255 ), then add the following entry.

$ route add -net 192.168.1.0 netmask 255.255.255.0 reject

Now, you cannot access any of the host in that network (for example: .51, .52, .53, etc.)

$ ping 192.168.1.51
connect: Network is unreachable

$ ping 192.168.1.52
connect: Network is unreachable

$ ping 192.168.1.53
connect: Network is unreachable

II. A Sample Network Architecture (to understand routing)

Let us use the following sample network architecture for the rest of the examples.

In the diagram below, we have 2 individual networks ( 192.168.1.0 and 192.168.3.0, with subnet mask of 255.255.255.0 ).

We also have a “GATEWAY” machine with 3 network cards. 1st card is connected to 192.168.1.0, 2nd card is connected to 192.168.3.0, and the 3rd card is connected to the external world.

5. Make 192.168.3.* Accessible from 192.168.1.*

Now we need to add a routing entry such that we are able to ping 192.168.3. series ip-addresses from 192.168.1. series. The common point we have is the GATEWAY machine.

So, on each machine in 192.168.1.* network a default gateway will be added as shown below.

$ route add default gw 192.168.1.10

Now when 192.168.1.1 pings 192.168.3.1, it will go to the GATEWAY via 192.168.1.10.

In GATEWAY, add the following routing entry.

$ route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.3.10

Now all the packets addressed to 192.168.3.* network will be forwarded via the 192.168.3.10 interface, which then delivers the packets to the addressed machine.

6. Make 192.168.1.* Accessible from 192.168.3.*

It is very similar to what we did earlier.

So, on each machine in 192.168.3.* network a default gateway will be added as shown below.

$ route add default gw 192.168.3.10

In GATEWAY, add the following routing entry.

$ route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.10

Now 192.168.3.* machines can ping 192.168.1.* machines.

7. Allow Internet Access ( External World )

In the previous two example, we have interconnected the 2 different networks.

Now we need to access the internet from these 2 different networks. For that, we can add a default routing ( when no routing rule matches ) to the 125.250.60.59 which is connected to the external world as follows.

$ route add default gw 125.250.60.59

This is how it works:

  1. Now when you try to access the internet (for example: ping google.com) from any of these machines (for example, from 192.168.3.2), the following is the sequence of events that happens.
  2. Since the destination (google.com) is not within 3.* series, it will be forwarded to GATEWAY via 3.10 interface
  3. In GATEWAY, it checks whether the destination is within 1.* range. In this example, it is not.
  4. It then checks whether the destination is within 2.* range. IN this example, it is not
  5. Finally, it takes the default route to forward the packets (i.e using the 125.250.60.59 interface, which is connected to the external world).

 

Ref.

http://www.thegeekstuff.com/2012/04/route-examples/

 

Further read:

http://rednooby.tistory.com/16?category=633018

http://rednooby.tistory.com/25

 

Advertisements

Port-forwarding in QNX

For some reason, I needed to forward certain packets from 8080 to 9021 in local,

In linux, you can simply use the iptable command to do it.

In FREEBSD based system like QNX, you need to use pf (Packet Filter pseudo-device).

Description:

Packet filtering takes place in io-pkt. A pseudo-device, /dev/pf, lets user processes control the behavior of the packet filter through an ioctl() interface. There are commands to enable and disable the filter, load rule sets, add and remove individual rules or state table entries, and retrieve statistics. The most commonly used functions are covered by pfctl.

  1. write pf.conf as follow:
    rdr proto tcp from any to any port 8080 -> 127.0.0.1 port 9021
  2. type following command:
    # pfctl -f /etc/pf.conf
    # pfctl -e
    OR in one line:
    # pfctl -F all ; pfctl -vvvvvef /etc/pf.conf

 

 

 Useful pfctl Options
Command Purpose
pfctl -e Enable PF.
pfctl -d Disable PF.
pfctl -F all -f /etc/pf.conf Flush all NAT, filter, state, and table rules and reload /etc/pf.conf.
pfctl -s [ rules | nat | states ] Report on the filter rules, NAT rules, or state table.
pfctl -vnf /etc/pf.conf Check /etc/pf.conf for errors, but do not load ruleset.

 

# Show Firewall Rules:
pfctl -sr
# Show NAT rules
pfctl -sn
# Show all
pfctl -sa

For more verbose output including rule counters, ID numbers, and so on, use:

pfctl -vvsr
Basic FreeBSD PF firewall for web server – /etc/pf.conf:
# vim: set ft=pf
# /etc/pf.conf</pre>
ext_if="vtnet0"

webports = "{http, https}"
int_tcp_services = "{domain, ntp, smtp, www, https, ftp}"
int_udp_services = "{domain, ntp}"

set skip on lo
set loginterface $ext_if

# Normalization
scrub in all random-id fragment reassemble

block return in log all
block out all

antispoof quick for $ext_if

# Block 'rapid-fire brute force attempts
table <bruteforce> persist
block quick from <bruteforce>

# ftp-proxy needs to have an anchor
anchor "ftp-proxy/*"

# SSH is listening on port 26
pass in quick proto tcp to $ext_if port 26 keep state (max-src-conn 15, max-src-conn-rate 5/3, overload <bruteforce> flush global)

# Webserver
pass proto tcp from any to $ext_if port $webports

# Allow essential outgoing traffic
pass out quick on $ext_if proto tcp to any port $int_tcp_services
pass out quick on $ext_if proto udp to any port $int_udp_services

To permanently block outgoing traffic to specific domains and/or ports you should create a new anchor file and add it to pf.conf.

  1. Create an anchor file org.user.block.out in /private/etc/pf.anchors
    sudo touch /private/etc/pf.anchors/org.user.block.out
    

    with the following content and a trailing empty line

    mybadtcphosts = "{ www.domain.com, domain.com, 135.0.9.17, 10.0.0.17 }"
    mybadtcpports = "{ 443, 80 }"
    mybadudphosts = "{ www.domain3.com, domain3.com, 27.134.89.124, 192.168.5.37 }"
    mybadudpports = "{ 53, 5353 }"
    
    block drop out proto tcp from any to $mybadtcphosts port $mybadtcpports
    block drop out proto udp from any to $mybadudphosts port $mybadudpports
    

    The additional domain names/IP addresses in mybad*hosts are just an example how to add additional domains. The same goes for the ports 80/5353 in mybad*ports.

    A simple but less flexible solution is:

    block drop out proto tcp from any to domain.com port 80
    
  2. Modify the file /private/etc/pf.conf but keep a trailing empty lineoriginal file:
    scrub-anchor "com.apple/*"
    nat-anchor "com.apple/*"
    rdr-anchor "com.apple/*"
    dummynet-anchor "com.apple/*"
    anchor "com.apple/*"
    load anchor "com.apple" from "/etc/pf.anchors/com.apple"
    

    to

    scrub-anchor "com.apple/*"
    nat-anchor "com.apple/*"
    rdr-anchor "com.apple/*"
    dummynet-anchor "com.apple/*"
    anchor "com.apple/*"
    anchor "org.user.block.out"
    load anchor "com.apple" from "/etc/pf.anchors/com.apple"
    load anchor "org.user.block.out" from "/etc/pf.anchors/org.user.block.out"
    
  3. Parse and test your anchor file to make sure there are no errors:
    sudo pfctl -vnf /etc/pf.anchors/org.user.block.out
    
  4. Now modify /System/Library/LaunchDaemons/com.apple.pfctl.plist from
    <array>
        <string>pfctl</string>
        <string>-f</string>
        <string>/etc/pf.conf</string>
    </array>
    

    to

    <array>
        <string>pfctl</string>
        <string>-e</string>
        <string>-f</string>
        <string>/etc/pf.conf</string>
    </array>
    

    You have to disable System Integrity Protection if El Capitan is installed to accomplish this. After editing the file reenable SIP. After rebooting your Mac pf will be enabled (that’s the -e option).

    Alternatively you may create your own launch daemon similar to the answer here: Using Server 5.0.15 to share internet WITHOUT internet sharing.

After a system update or upgrade some of the original files above may have been replaced and you have to reapply all changes.

Sample /etc/pf.conf


#### First declare a couple of variables ####
### Outgoing tcp / udp port ####
### 43 - whois, 22 - ssh ###
tcp_services = "{ ssh, smtp, domain, www, https, 22, ntp, 43,ftp, ftp-data}"
udp_services = "{ domain, ntp }"
### allow ping / pong ####
icmp_types = "{ echoreq, unreach }"

#### define tables. add all subnets and ips to block
table <blockedip> persist file "/etc/pf.block.ip.conf"

martians = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8, 169.254.0.0/16, 192.0.2.0/24, 0.0.0.0/8, 240.0.0.0/4 }"

### admin server ranges ###
adminrange = "112.220.11.0/23"

# connected to internet
ext_if = "em1"
# connected to vpn / lan
int_if = "em0"

##### ftp proxy
#proxy="127.0.0.1"
#proxyport="8021"

#### Normalization
#scrub provides a measure of protection against certain kinds of attacks based on incorrect handling of packet fragments
scrub in all

#### NAT and RDR start
#nat-anchor "ftp-proxy/*"
#rdr-anchor "ftp-proxy/*"

# redirect ftp traffic
#rdr pass proto tcp from any to any port ftp -> $proxy port $proxyport

# Drop incoming everything
block in all
block return

# keep stats of outgoing connections
pass out keep state

# We need to have an anchor for ftp-proxy
#anchor "ftp-proxy/*"

# unlimited traffic for loopback and lan / vpn
set skip on {lo0, $int_if}

# activate spoofing protection for all interfaces
block in quick from urpf-failed

#antispoof is a common special case of filtering and blocking. This mechanism protects against activity from spoofed or forged IP addresses
antispoof log for $ext_if

#Block RFC 1918 addresses
block drop in log (all) quick on $ext_if from $martians to any
block drop out log (all) quick on $ext_if from any to $martians

&nbsp;

# Block all ips
# pfctl -t blockedip -T show
block drop in log (all) quick on $ext_if from <blockedip> to any
block drop out log (all) quick on $ext_if from any to <blockedip>

# allow outgoing
pass out on $ext_if proto tcp to any port $tcp_services
pass out on $ext_if proto udp to any port $udp_services

# Allow trace route
pass out on $ext_if inet proto udp from any to any port 33433 >< 33626 keep state

# Allow admin to get into box
pass in on $int_if from $adminrange to any

# Allow incoming ssh, http, bind traffic
# pass in on $ext_if proto tcp from any to any port 25
pass in on $ext_if proto tcp from any to any port ssh flags S/SA synproxy state
pass in on $ext_if proto udp from any to any port domain
pass in on $ext_if proto tcp from any to any port domain flags S/SA synproxy state
pass in on $ext_if proto tcp from any to any port http flags S/SA synproxy modulate state
pass inet proto icmp all icmp-type $icmp_types keep state
## add your rule below ##

PF sample configuration

To setup PF you will first need enable PF and define where the rules file will reside. This can be done by editing /etc/rc.conf and adding the following lines:
pf_enable=”YES”
pf_rules=”/etc/pf.conf”
Next, you must define the rule set which you will put in /etc/pf.conf. Below is an example which essentially allows all outgoing traffic and blocks anything other than TCP ports 22, 80, and 443. It will also allow incoming ICMP unreachable and echo requests.
# PF Rules Example
## definitions
## make sure to set these for your environment
public_int = “em0”                      # public interface
tcp_svcs = “{ 22 80 443 }”              # tcp service ports
icmp_types = “{ echoreq, unreach }”     # icmp types
 
## ignore loopback interface
set skip on lo
 
## restrict incoming traffic / unrestrict outgoing traffic
block in all
pass out all
 
## allow tcp ports specified by $tcp_svcs
pass in quick on $public_int proto tcp from any to any port $tcp_svcs
 
## allow icmp request types specified by $icmp_types
pass in inet proto icmp all icmp-type $icmp_types
You can now start PF by rebooting. Or you can load it manually, without rebooting, by running the following:
/etc/rc.d/pf restart
If you want to verify the PF rule set has been loaded, use the command:
pfctl -s rules
Which should output something similar to:
block drop in all
pass out all flags S/SA keep state
pass in quick on em0 proto tcp from any to any port = ssh flags S/SA keep state
pass in quick on em0 proto tcp from any to any port = http flags S/SA keep state
pass in quick on em0 proto tcp from any to any port = https flags S/SA keep state
pass in inet proto icmp all icmp-type echoreq keep state
pass in inet proto icmp all icmp-type unreach keep state

FYI.

rdr only monitors in-coming packets,
nat monitors out-going packets, but only changes source NAT.
Ref.:

cross-compile libdmclient for QNX

download the source:

# git clone https://github.com/01org/libdmclient.git

autoconf the source:

# autoconf –install

set the qnx compile environment:

# source ~/qnx70/qnxsdp-env.sh

create the compile.sh file as follow:


export CC="qcc -V5.4.0,gcc_ntoaarch64le"
export CXX="q++ -V5.4.0,gcc_ntoaarch64le"

export LIBCURL_CFLAGS=-I/home/jiafei427/qnx70/target/qnx7/usr/include/curl
export LIBCURL_LIBS=-L/home/jiafei427/qnx70/target/qnx7/aarch64le/usr/lib
export SQLITE3_CFLAGS=-I/home/jiafei427/qnx70/target/qnx7/usr/include
export SQLITE3_LIBS=-L/home/jiafei427/qnx70/target/qnx7/aarch64le/usr/lib

echo "-- cleaning...."
make clean

./configure --prefix=/home/jiafei427/tmp/test/oma-dm/libdmclient/output --host=aarch64-nto-qnx CFLAGS="-I/home/jiafei427/qnx70/target/qnx7/usr/include/io-pkt/machine/ -I/home/jiafei427/qnx70/target/qnx7/usr/include/io-pkt/"

echo "-- Building"

make VERBOSE=1

echo "-- finish building"
make install

then it will compile the libdmclient to the output folder. 🙂

 

I tried to compile the test programs too, but there was some errors, so I just gave up.

 

Hope it can help others.

cheers!

SCP related tips and issue resolve

Today, I had trouble to send a file to remote target board with the command following:


jiafei427@CKUBU:~/tmp$ scp /home/jiafei427/tmp/slrclub_cert.crt root@10.177.247.35:/var/tmp/usr/ck
sh: scp: cannot execute - No such file or directory
lost connection

Damn, had no clue what that meant, and googled like a forever.

used “-vvv” option, but nothing that I can recognize.

 

Finally found solution by myself, and actually that was a bit too easy.

Solution is simply put a “scp” binary into the target board.

scp will use the binary both in client and server side. 😦

(didn’t know that..)

 

Here put more examples about scp:

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Examples

Copy the file “foobar.txt” from a remote host to the local host

$ scp your_username@remotehost.edu:foobar.txt /some/local/directory

Copy the file “foobar.txt” from the local host to a remote host

$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy the directory “foo” from the local host to a remote host’s directory “bar”

$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar

Copy the file “foobar.txt” from remote host “rh1.edu” to remote host “rh2.edu”

$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \
your_username@rh2.edu:/some/remote/directory/

Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host

$ scp foo.txt bar.txt your_username@remotehost.edu:~

Copy the file “foobar.txt” from the local host to a remote host using port 2264

$ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy multiple files from the remote host to your current directory on the local host

$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .
$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .

scp Performance

By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.

$ scp -c blowfish some_file your_username@remotehost.edu:~

It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:

$ scp -c blowfish -C local_file your_username@remotehost.edu:~

 

 

Ref.

http://www.hypexr.org/linux_scp_help.php

 

 

 

 

 

 

 

 

 

Mount QNX file system


# df -h
/dev/emmc/uda0.ms.2 95M 15M 80M 16% /efs/
/dev/emmc/uda0.97d7 2.9G 955M 2.0G 32% /base/
/dev/emmc/rpmb0 4.0M 4.0M 0 100%
/dev/emmc/boot1 2.0K 2.0K 0 100% /dev/emmc/boot1.
/dev/emmc/boot1 4.0M 4.0M 0 100%
/dev/emmc/boot0 4.0M 4.0M 0 100%
/dev/emmc/uda0 43G 43G 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 12G 12G 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.f
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 256M 256M 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 8.0K 8.0K 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 33M 33M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 16M 16M 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 58G 58G 0 100%

&nbsp;

PS. can't use this 43G of free spaces, so I needed to create a qnx6 filesystem on it and mount it

&nbsp;

# df -n /dev/emmc/uda0.97d7b011-54da-4835-b3c4-917ad6e73d74.17
Filesystem Mounted on Type
/dev/emmc/uda0.97d7 /base/ qnx6

# df -n /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47
Filesystem Mounted on Type
/dev/emmc/uda0 /dev/emmc/uda0.a blk-partition

# mkqnx6fs /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47

# mount -t qnx6 /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47 /shit/

# df -nh /shit
Filesystem Mounted on Type
/dev/emmc/uda0.aa9a /shit/ qnx6

# df -Ph /shit
Filesystem Size Used Available Capacity Mounted on
/dev/emmc/uda0.aa9a 43G 1.3G 41G 4% /shit/

 

Ref.

http://dooeui.blogspot.kr/2014/11/qnx-neutrino-v6.html

 

[node.js] Error: setuid user id does not exist

 


# npm config ls -g
Error: setuid user id does not exist
at /base/usr/npm/node_modules/uid-number/uid-number.js:49:16
at ChildProcess.exithandler (child_process.js:197:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: ENOENT: no such file or directory, open 'npm-debug.log.3559331957'
at Error (native)

modify the file /base/usr/npm/node_modules/uid-number/uid-number.js

Goto line 11 and replace uidSupport = process.getuid && process.setuid with uidSupport = false

 

problem solved.

node.js dev. tips for myself

=======================================
default location for node_modules:


/usr/local/lib/node_modules$

<code>usr/lib/node_modules</code>

 

with following command you can check the node-modules location which npm will install to:


$ npm prefix -g
/usr/local

 

when you want to develop node.js code in Sublime, install Docblock(comment_generator) and Nodejs(autocomplete) for sublime!
https://github.com/spadgos/sublime-jsdocs
https://packagecontrol.io/packages/Nodejs

 

 

CRTL+B to run the program and observe result inside sublime

 

 

Ref.:

http://scottksmith.com/blog/2014/09/29/3-essential-sublime-text-plugins-for-node-and-javascript-developers/