ICS 54 Klefstad Networking and Communications Networking and Interprocess Communication (IPC) . local area networks (LAN) . small distance between hosts (one organization) . high speed transfer lines (3-10 mbytes/sec) . eg Ethernet . wide area networks (WAN) remote networks . large physical distances between hosts . medium speed transfer lines (less than 100 kbytes/sec) . eg ARPANet, CSNet . `protocols` are standard rules for: . initiating and terminating logical connections . address and data format . manner of transmission . remote and local services Unix IPC Model: Sockets . sockets are I/O descriptors that may span machines . provide two-way interprocess/intermachine communication . some operations on sockets . socket - creates (open) a socket descriptor . connect - joins two or more sockets for I/O . send/write - sends a message to a socket . select - query status of a socket . recv/read - gets a message from a socket . close - close a socket A Standard Protocol . tcp/ip allow for data transmission/reception over networks . ip - Internet Protocol . low-level network protocol . initiated with s = socket(AF_INET, SOCK_RAW, 0); . tcp - Internet Transmission Control Protocol . high-level sequenced, two-way byte-stream protocol . initiated with s = socket(AF_INET, SOCK_STREAM, 0); Mail Transfer . uucp source_file dest_file . copies files between machines along an explicit network path . remote files are specified as system!file . uusend can deliver across a network path . uux command . gathers files from various systems, then executes a command . eg uux "!diff bonnie!~/foo blanche!~/bar > ics!~/diff" . uucico transfers files queued by uucp or uux Remote login . rlogin allows login on another Unix machine . behaves like a direct login and sets TERM variable . % rlogin host [-l remote_userid] . ~ escapes . ~. - same as logout . ~^Z - suspends rlogin . telnet and tip are like rlogin, but useful for non-Unix machines Remote shell . rsh executes a specified command on a specified host . % rsh host [-l userid] [-n] [command] . remote stdin, stdout, and stderr are connected to those of the local machine . if command is omited, it does rlogin . remote file-name meta-characters must be quoted Remote copy . rcp allows limited file copying across Unix machines . % rcp from_file to_file . % rcp [-r] files... directory . files are of the form: . user@host:file_path . eg rcp klefstad@bonnie:bin/"*" . . `user` defaults to you . `host` defaults to local machine . relative file path is relative to user's home . remote file-name meta-characters must be quoted Equivalent hosts . passwords are required for rlogin, but are waved for equivalent hosts . ~userid/.rhosts . contains list of trusted hosts that may login as userid . allows rcp and rlogin without password . eg on bonnie, my .rhost file clipperton.ics.uci.edu klefstad blanche.ics.uci.edu klefstad . /etc/hosts.equiv . master list of trusted hosts ARPANet File Transfer Program . ftp allows standard file copy interface across networks . user logs in to both machines, so is more general than rcp . % ftp [host] . cd, ls, mkdir - Unix commands on remote machine . lcd - cd on local machine . !cmd - Unix command on local machine . prompt - turn off confirmation prompting . mget *.dvi - copy remote *.dvi to local . mput *.tex - copy local *.tex to remote . quit - leave ftp command processor . ? [command] - help for command Network Databases and Address Mapping . /etc/hosts . list of internet and local hosts accessible from local machine . eg # Subnet 3: Machines behind london in cs 308 # Address Full name Aliases 128.195.3.1 londongw.ics.uci.edu london londongw clgw labgw 128.195.3.5 bloomsbury.ics.uci.edu lab4 bloomsbury cl3 128.195.3.8 whitechapel.ics.uci.edu whitechapel lab7 cl6 . /etc/networks . list of DARPA networks . eg # Net name Net number Alias uciics-net 128.195 uciics-main 128.195.1 localnet uciicslab 128.195.3 ucilabnet uci-labnet uciicsrsh 128.195.4 ucirshnet uci-rshnet . /etc/services . list of available network services . eg # Service name Port/Protocol Alias uucp 540/tcp uucpd chforw 701/tcp chforwd exec 512/tcp execserver login 513/tcp loginserver . /etc/protocols . information about known protocols . eg # Internet (ip) protocols # name Number Alias # Comment ip 0 ip # internet protocol, pseudo protocol number icmp 1 icmp # internet control message protocol ggp 3 ggp # gateway-gateway protocol tcp 6 tcp # transmission control protocol pup 12 pup # parc universal packet protocol udp 17 udp # user datagram protocol