Feeds:
Posts
Comments

Get MAC based on IP

  1.  ping <ip>
ping 192.168.86.45
Pinging 192.168.86.45 with 32 bytes of data:
Reply from 192.168.86.45: bytes=32 time=290ms TTL=1282

2. arp -a
Interface: 192.168.86.38 --- 0x3
Internet Address Physical Address Type
192.168.86.1 70-3a-cb-14-11-7a dynamic​
192.168.86.45 98-90-96-B9-9D-61 dynamic
192.168.86.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.251 01-00-5e-00-00-fb static


		
Advertisements

Zone Index in IPv6

It is basically interface ID/name.

It should be noted that in contexts other than a user interface, a
zone identifier is mapped into a numeric zone index or interface
number. [Ref: RFC 6874]

Suppose, If I want to ping fe80:2345::2004 (same LAN) from my PC.
My PC has two NIC cards and its network part will be same i.e fe80
NIC1 = fe80:2345::2003
NIC2 = fe80:1234::2005

Now, which interface does ping use to send ICMP-request to destination?
Does it asks OS? It could be but how OS decides bw two interface?
Does it have intelligence to determine shortest distance (like router) ?

Answer is None of above. [ But why? I dont know . Only expert can answer ]

In unix
NIC1 = fe80:2345::2003%eth1
NIC2 = fe80:1234::2005%eth2

In windows
NIC1 = fe80:2345::2003%18
NIC2 = fe80:1234::2005%20

So, We should mention zone-id with target link-local address

In unix
ping fe80:2345::2004%eth1  <— use eth1

In windows
ping fe80:2345::2004%18 <— use interface whose ID is 18

people

Initialize structure elements

static struct itimerspec timeout_retv = {
    .it_interval.tv_sec = 0,
    .it_interval.tv_nsec = 0,
    .it_value.tv_sec = MIN_RETV_TIMEOUT,
    .it_value.tv_nsec = 0
};

It’s sometimes called “designated initialization”. This is a C99 addition, though it’s been a GNU extension for a while.

In the list, each . names a member of the struct to initialize, the so called designator.
 This is used for initialization of struct members (they are not variables) in the "new" C99 style (some compilers may have used the same format even before C99 was issued).

struct Employee
{
     char ename[20];
     int ssn;
     float salary;
     struct date<--- init of a structure inside structure
     {
            int date;
            int month;
            int year; 
     }doj;
}emp = {"Andrew",1000,1000.50,{22,6,1990}}; <--- init of a structure inside structure

1. Make  to-do list and follow it
When I created list, I couldnot make it for about 15 days, was spending time on time in TV, social media, online shopping
which makes me happy(time being)
But when I looked at list its disappointing.
So I made small goals. like1. Make a list of to do and follow it

a)  Atleast 5 task to watch TV
b)  Atleast 8 tasks to do online shopping
ITS WORKinggg

Share your steps too.

ctags

Believe me, it makes c-code browsing  a lot easier and simpler. So install

1.sudo apt-get install ctags
2.Download taglist.zip from git/sourceforge
https://github.com/vim-scripts/taglist.vim
3. Untar taglist.zip to ~/.vim
~/.vim$ ls
doc plugin README

~/.vim$ ls plugin/
taglist.vim
4. Restart vim/gvim
Eg: vim file.c
use ‘:TlistOpen’ to list function
TlistAddFilesRecursive pathtodir

 

Refer ~/.vim/doc/taglist.txt for more help options

vnc: connection error

Error:

unable to connect to socket connection refused 111

or

unable to connect to host: No route to host (113)

Reason:

Machine on which VNC server running is blocking the port 5904 ( vnc server on port 5904)

Solution:

Stop vncserver and add port 5901 to iptables in accept mode. Its for temporary. Save iptables if you need changes permanently.

sudo iptables -I INPUT 1 -p tcp --dport 5904 -j ACCEPT