Difference between Http and Https?
What difference between HA active/active and HA active/passive
HA act/act, separate connection table, sync connection for TCP sync/ack, can be happened on either active node
HA act/pas, unique connection table, but sync over failover link, one failed, another one can quickly pick up
How to isolate or action on malicious patching/downloading
https inspection, send to antivirus, anti-bot, sandbox before to user.
What is https inspection on the firewall
Generate ssl cert at the firewall, act as man-in-the-middle between user and server, user -> FW(443), FW inspection > FW -> Server(443)
What is Health Checker option on the F5
What is OSPF area, why need area?
reduce LSU/LSA ; Routing table optimization;
What is spanning-tree protocol
L2 loop prevent in a broadcast domain; such as broadcast storm, broad received on a switch interface will flood to all interfaces except the reciving one, if the topology is not loop-free, there is likely to have loop all broadcast packets.
What tables can be read from switch, what is CEF?
mac-address table (mac-interface mapping)
arp-table (mac-ip mapping)
cef talbe (stored RIB for quicker fwd)
routing table (routes-nexthop mapping)
How is Traceroute work?
What is the wireless LAN controller?
What do you think of whitebox switch?
What is voice traffic to be treated in QoS, and why.
EF class map
priority queue
What is NBAR
Network Based Application Recognition (NBAR) is a mechanism that classifies and regulates bandwidth for network applications to ensure that available resources are utilized as efficiently as possible
# connection vs connectionless
What are TCP Flags?
TCP flags are used within TCP packet transfers to indicate a particular connection state or provide additional information. Therefore, they can be used for troubleshooting purposes or to control how a particular connection is handled. There are a few TCP flags that are much more commonly used than others as such “SYN”, “ACK”, and “FIN”. However, in this post, we’re going to go through the full list of TCP flags and outline what each one is used for.
List of TCP Flags
Each TCP flag corresponds to 1 bit in size. The list below describes each flag in greater detail. Additionally, check out the corresponding RFC section attributed to certain flags for a more comprehensive explanation.
SYN - The SYN, or Synchronisation flag, is used as a first step in establishing a 3-way handshake between two hosts. Only the first packet from both the sender and receiver should have this flag set. The following diagram illustrates a 3-way handshake process.
ACK - The ACK flag, which stands for “Acknowledgment”, is used to acknowledge the successful receipt of a packet. As we can see from the diagram above, the receiver sends an ACK as well as a SYN in the second step of the 3-way handshake process to tell the sender that it received its initial packet.
FIN - The FIN flag, which stands for “Finished”, means there is no more data from the sender. Therefore, it is used in the last packet sent from the sender.
URG - The URG flag is used to notify the receiver to process the urgent packets before processing all other packets. The receiver will be notified when all known urgent data has been received. See RFC 6093 for more details.
PSH - The PSH flag, which stands for “Push”, is somewhat similar to the URG flag and tells the receiver to process these packets as they are received instead of buffering them.
RST - The RST flag, which stands for “Reset”, gets sent from the receiver to the sender when a packet is sent to a particular host that was not expecting it.
ECE - This flag is responsible for indicating if the TCP peer is ECN capable. See RFC 3168 for more details.
CWR - The CWR flag, which stands for Congestion Window Reduced, is used by the sending host to indicate it received a packet with the ECE flag set. See RFC 3168 for more details.
NS (experimental) - The NS flag, which stands for Nonce Sum, is still an experimental flag used to help protect against accidental malicious concealment of packets from the sender. See RFC 3540for more details.
Analyzing TCP Flags in the CLI
You can view which TCP flags are being used for every TCP packet directly from within your command line interface. To do so, you need to run a tcpdump. This needs to be done by a root user so if you don’t have root access, try running the following:
sudo tcpdump
This will allow you to analyze all packets being sent and will display packets containing any of the TCP flags. However, if you would like to run a tcpdump only on packets containing a certain flag you can use one of the following commands.
ACK sudo tcpdump 'tcp[13] & 16 != 0'
SYN sudo tcpdump 'tcp[13] & 2 != 0'
FIN sudo tcpdump 'tcp[13] & 1 != 0'
URG sudo tcpdump 'tcp[13] & 32 != 0'
PSH sudo tcpdump 'tcp[13] & 8 != 0'
RST sudo tcpdump 'tcp[13] & 4 != 0'
Summary
Knowing your TCP flags can be quite useful for troubleshooting purposes. If you need to quickly analyze your TCP packets, it’s easy to run a tcpdump command for a particular flag and then retrieve the results you require. Be sure to check out the RFC section of any of the corresponding TCP flags above to go into even greater detail of what each one is used for and how it works.
Top
PS
free -h
memory
diff
Linux Find Out Which Process Is Listening Upon a Port
netstat command
what is the difference between python2 and python3 on divide algorith
3/2 = ?
python3 = 1.4
python2 = 1
========================
a = '1'
b = '3'
int(a)+int(b)
========================
vowels('cradle')
['a','e']
c= ["'a"',"'e'",'"i"',"'o","'u"]
d= []
def vowels(a):
b = [x for x in a]
for i in b:
if i in c:
d.append(i)
vowels("ireland")
========================
simple just count how many vowels in the word.
import re
def count_vowels(str):
return len(re.findall(("a|e|i|o|u"), str, re.IGNORECASE))
print (count_vowels( "foobar" )) # 3
print (count_vowels( "gym" )) # 0
print (count_vowels( "ireland" )) # 3
========================
Given raw text, find which words within the text that contain each vowel and return it as an object
# and y this time
vowels = ['a','e','i','o','u','y']
text = "You may be sitting quietly in your armchair, but you are far from motionless. I don't mean merely that your heart is beating, your blood is coursing through your veins and you are panting at the prospect of learning so many fascinating things from this book. In short, I don't mean simply that you are physically and mentally alive."
response = {
'a':['apple','april'],
'e':['apple','red'],
'i':['it','kit'],
etc
}
# note: a word can exist under multiple keys.
# if poss
vowels = ['a','e','i','o','u','y']
text = "You may be sitting quietly in your armchair, but you are far from motionless. I don't mean merely that your heart is beating, your blood is coursing through your veins and you are panting at the prospect of learning so many fascinating things from this book. In short, I don't mean simply that you are physically and mentally alive."
========================
text = 'You mat be, i call matt be two'
wordlist = text.lower().split()
c= [ list(x) for x in wordlist ]
for i in c:
if ',' in i:
i.remove(',')
new_wordlist = ["".join(x) for x in c]
response = {}
vowels = ['a', 'e', 'i', 'o', 'u', 'y']
#response = response.fromkeys(vowels,[])
response = {'a': [], 'e': [], 'i': [], 'o': [], 'u': [], 'y': []}
print (wordlist)
print (response)
#
print ( )
def res(w,v):
wordlist=w
vowels=v
for i in wordlist:
for j in vowels:
if j in i:
#print(i, j, response[j])
response[j].append(i)
response[j]=list(set(response[j]))
return response
import json
print (json.dumps(res(new_wordlist,vowels), indent=4))
========================
Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
Example:
Given the following matrix:
[
[ 1 , 2 , 3 ],
[ 4 , 5 , 6 ],
[ 7 , 8 , 9 ]
]
You should return [1,2,3,6,9,8,7,4,5].
class Solution:
# @param matrix, a list of lists of integers
# @return a list of integers
def spiralOrder(self, matrix):
result = []
if matrix == []:
return result
left = 0
right = len(matrix[0]) - 1
top = 0
bottom = len(matrix) - 1
# (left, right, top, bottom) = 定义 左,右,上,下, 然后按逻辑推
while left <= right and top <= bottom:
print left, right, top, bottom
for j in xrange(left, right + 1):
result.append(matrix[top][j])
print left, right, top, bottom
for i in xrange(top + 1, bottom):
result.append(matrix[i][right])
print left, right, top, bottom
for j in reversed(xrange(left, right + 1)):
if top < bottom:
result.append(matrix[bottom][j])
print left, right, top, bottom
for i in reversed(xrange(top + 1, bottom)):
if left < right:
result.append(matrix[i][left])
print left, right, top, bottom
left, right, top, bottom = left + 1, right - 1, top + 1, bottom - 1
print left, right, top, bottom
return result
==================
Phone Screen#
requirement:
devices = ['ssw-001.alt1', 'fsw-001.alt1', "esw-003.dub1", "sww-002.alt1", "fsw-003.alt1", "esw-002.dub1"]
output:
alt1{
ssw[
sww-001.alt1,
sww-002.alt1
]
fsw[
fsw-001.alt1,
fsw-003.alt1
]
}
dub1{
esw[
esw-003.dub1
]
sww[
sww-002.dub1
]
ANS######################
import json
mydict={}
for dev in devices:
location = dev[-4:]
type = dev[0:3]
if location not in mydict: # 检测location是否存在于现有 字典
mydict[location]= {} # 创建新的key as location 并定义为 空dictionary
if type not in mydict[location]:
mydict[location][type]=[] # 创建新的key as type, 并定义为 空list
mydict[location][type].append(dev)
检测输出1:
print (json.dumps(mydict, indent=4))
>>>x
{
"alt1": {
"sww": [
"sww_001.alt1",
"sww-002.alt1"
]
},
"alt2": {
"fsw": [
"fsw_001.alt2"
]
},
"dub1": {
"esw": [
"esw-003.dub1",
"esw-002.dub1"
]
},
"alt3": {
"fsw": [
"fsw-003.alt3"
]
}
}
>>> x["dub1"]
{'esw': ['esw-003.dub1', 'esw-002.dub1']}
>>> x["dub1"]["esw"]
['esw-003.dub1', 'esw-002.dub1']
>>> x["dub1"]["esw"][1]
'esw-002.dub1'
检测输出2:
for x in mydict:
print (x)
for y in mydict[x]:
print (y,':',mydict[x][y])
alt1
sww : ['sww_001.alt1', 'sww-002.alt1']
alt2
fsw : ['fsw_001.alt2']
dub1
esw : ['esw-003.dub1', 'esw-002.dub1']
alt3
fsw : ['fsw-003.alt3']